3

I am new to sencha touch and i want to consume soap web service in sencha touch.I have written code for this cause, but the problem is that I am getting just plain HTML content as response not the soap object. And I dont know how to call a specific method from web service to sencha touch.

Here's my code :-

Ext.Ajax.request({

    method: 'get',
    url: 'http://192.168.1.15:80/himanshu/helloworldwebservice.asmx',
    success: function (response, request) { 
    alert('Working!') 
    alert(response.responseText)
    console.log('Response:-'+response.responseText)
    },
    failure: function (response, request) {
    alert('Not working!')
    console.log('Response Status:- '+response.status)
    }

});

EDIT:- Ok i got the idea to call a specific method from web service from here.Like i have HelloWorld() method which only returns a single string and my url is http://192.168.1.15:80/himanshu/helloworldwebservice.asmx. I can call HelloWorld() method by setting my url like this :- http://192.168.1.15:80/himanshu/helloworldwebservice.asmx/HelloWorld

But its not working for me.Every time i run the program 'Not Working' alert generates and 500 is the response stats i gets.Please make me understand that how can i call methods from webservice.Thanx in advance.

himanshu
  • 1,990
  • 3
  • 18
  • 36
  • see this [link](http://stackoverflow.com/questions/11556508/web-service-call-from-ie-is-working-but-its-not-working-in-chrome-and-mozilla) before some days i found the same problem and then got the solution. – Rikin Thakkar Jul 21 '12 at 05:58

3 Answers3

3

You will not be able to consume your SOAP webservice in this way, since performing a GET request on the asmx url will just return you the HTML content for the page listing your webservice methods.

Consuming SOAP webservices relies on POST requests and need that you send a correct XML SOAP request. I may suggest you to use something like http://archive.plugins.jquery.com/project/jqSOAPClient to execute your SOAP calls and retrieve your data and then pass them back to your Ext code.

Hope this helps

Nacef

Nacef
  • 433
  • 4
  • 8
  • I dont want to use jQuery in my app so can you tell me how can i achieve this with AJAX call. – himanshu Mar 05 '12 at 12:05
  • Sorry it's been a while that I did not look to mailbox. Have you managed to make it work ? – Nacef Apr 04 '12 at 16:25
  • 3
    Could you please share the solution, I'm interested in knowing how you managed it – Nacef Apr 05 '12 at 23:21
  • @himanshu : Can you please share your solution. Because I've been searching for a way to do this for a really long time now. – SashaZd May 09 '12 at 06:41
  • 1
    This is the working code that i have posted in question....I have problem with webservice that is solved now. – himanshu May 09 '12 at 06:43
0

You can make use of : SOAP Data Proxy http://www.sencha.com/blog/taking-a-look-at-the-new-sencha-soap-data-proxy

Sagar Mody
  • 525
  • 5
  • 9
0

Your code is absolutely fine. I think you are sending HTML data from the server side. Do check the response in Chrome/Safari Developer Tools. Also, use console.log() function instead of alert() function for a better view.

Also, open this url: "http://192.168.1.15:80/himanshu/helloworldwebservice.asmx" in browser and "View source" of the page - you will see what exactly you are sending.

Swar
  • 5,473
  • 3
  • 31
  • 43
  • I know that i am getting the html content of URL:- "http://192.168.1.15:80/himanshu/helloworldwebservice.asmx" .My problem is that i dont know how can i call the methods which are present in the above webservice? – himanshu Mar 05 '12 at 09:30
  • I have also checked the response in chrome and safari but only getting the dialog with msg "Not Working". – himanshu Mar 05 '12 at 10:16
  • Create a new file, write a switch-case and call different functions . Send one extra parameter on which you will do the switch case. – Swar Mar 05 '12 at 15:22
  • But how will i call the different methods of a web service with external URL. My URL:- "192.168.1.15:80/himanshu/helloworldwebservice.asmx"; is hosted on different computer. – himanshu Mar 07 '12 at 06:06
  • See, forget about Sencha and try to access the urls from your browser directly. You yourself need to ensure how you will call the methods. So, if you get any raw data in browser, the same data will be used in your app too. – Swar Mar 09 '12 at 05:46