1 Reply Latest reply on Jul 9, 2012 12:14 AM by Dave van der Veen

    how to call WSDL web service using AsyncHttpAPI?

      Hi,

       

      Ho to call WSDL web service using AsyncHttpAPI?

       

      Thank you.

        • Re: how to call WSDL web service using AsyncHttpAPI?
          Dave van der Veen

          Add the attribute [ScriptService] to the webservice. This will allow the Webservice to respond with json.

           

          [ScriptService]
          public class MobileClient : System.Web.Services.WebService
          {
                    [WebMethod]
                    public String[] GetData
                    {
                         ...
                    }
          }
          

           

          Then call the webservice from ruby.

           

          require 'rho'
          require 'json'
          
          class WebServiceHelper
            def self.DoCall( function, params = {} )
               
            result = Rho::AsyncHttp.post(
              :url => 'http://localhost/Webservice/MobileClient.asmx/' + function,
              :headers => { 'Content-Type' => 'application/json' },
              :body => params.to_json    
              )
              return result[ 'body' ][ 'd' ]
            end
          end