0

I have found this post that worked for me but I recieved a HTML response instead of a XML one which is what I need for my app.

How to consume SOAP web service in SENCHA TOUCH?

This is my request to my server... I know I should be doing a POST action as this guy was told, but I still get a root node error.

Is this the proper way to consume a WebService, or there is another way to consume in Sencha using data models and stores? I have already saw an example using CFC but I am using IIS 7.5

POST /url/mobilews.asmx HTTP/1.1
Host: 10.0.1.182
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/HelloWorld"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <HelloWorld xmlns="http://tempuri.org/" />
  </soap:Body>
</soap:Envelope>




Ext.Ajax.request({
    method: 'GET',
    url: 'http://url/mobileservice/mobilews.asmx?op=HelloWorld',
    params: { method: 'HelloWorld', format: 'json' },
    success: function (response, request) {
        alert('Working!');
        alert(response.responseText);


    },
    failure: function (response, request) {
        alert('Not working!');
    }
});

Here goes the error message:

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Receiver</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">System.Web.Services.Protocols.SoapException: Server was unable to process request. ---&gt; System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
Community
  • 1
  • 1
Joaquin
  • 1
  • 2
  • Can you add your `Ext.Ajax.request` code to the question? – sherb Nov 11 '14 at 16:20
  • I have just updated the post with the ajax request. Thanks. – Joaquin Nov 11 '14 at 16:51
  • SOAP requests are usually required to be `POST`. Is there something else missing from your question? Root node errors happen when an `Ext.data.Reader` object can't parse the response, but there wouldn't be a `Reader` object involved in this. Can you provide the exact error you're getting? – sherb Nov 11 '14 at 17:00
  • @sherb thanks for your response. I have provided the error message in the post... Do you have an example code on how to perform a SOAP request on SENCHA TOUCH? I am new to sencha and having losts of trouble. – Joaquin Nov 11 '14 at 17:40
  • That server-side error is generated because it doesn't understand the request. You'll need to attach your request body in an `xmlData` parameter and use `POST` as the method. Have you successfully used this web service with another platform or tool, like SoapUI? I'd do that first, then focus on the Sencha Touch coding. – sherb Nov 11 '14 at 18:11

0 Answers0