Results 1 to 3 of 3

Thread: WebServices and JSon response

  1. #1
    Join Date
    Jul 2011
    Posts
    2

    Unhappy WebServices and JSon response

    Can't find a way to have spring.net webservice (WebServiceExporter) return data in json format... help!

  2. #2
    Join Date
    Apr 2012
    Posts
    2

    Default

    Me, too.
    Is there any one that answers questions?

  3. #3
    Join Date
    Jul 2011
    Posts
    2

    Post

    Quote Originally Posted by adun View Post
    Me, too.
    Is there any one that answers questions?
    Spring.net can't do it..

    i did this way:

    normal webservice and used Spring.Context.Support.ContextRegistry.GetContext( ).GetObject("service"); to load spring service.

    Code:
        [WebService(Namespace = "http://tempuri.org/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        [ScriptService]
        public class JSonService:WebService
        {
            private IDataService _dataService;
            public IDataService DataService
            {
                get
                {
                    if (_dataService==null)
                    {
                        _dataService = (IDataService) ContextRegistry.GetContext().GetObject("DataService"); 
                    }
                    return _dataService;
                }
            }
    
            [WebMethod]
            [ScriptMethod(UseHttpGet = false, ResponseFormat = ResponseFormat.Json, XmlSerializeString = false)]
            public List<DataItem> GetAutocomplete(string q)
            {
                return DataService.GetAutocomplete(q);
            }
        }
    using it without problems for almost six months.

    anyway Spring really SHOULD BE ABLE to return JSON

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •