简体   繁体   中英

Call a SOAP based web-service using JQuery in Phonegap

I have a big problem regarding to call a web-service through Jquery .

I am developing one phonegap application same as Android application right now.In that I have to call a web-service and fetch data from there.I tried to solve it in my way but i didn't find proper solution.

My web-service is built in .NET using SOAP . And now i want to call that web-service through my HTML page using jquery . So, Please help me to solve this problem.

Thanks in Advance.

You can use XMLHttpRequest to connect with external domain this is the sample code

      function connectXml()
        {
     var request = new XMLHttpRequest();
             var wsUrl="http://www.somedomain.com/servicexml"
     request.open("POST", wsUrl, true);
     request.onreadystatechange = function() {
     if (request.readyState == 4) {
     if (request.status == 200 || request.status == 0) {
     var data = request.responseText;

                alert(request.responseText);
                }}}}

Note:Give access to the domain in config.xml eg:access origin="http://somedmain.com". Add user INTERNET permission in AndroidManifest.xml eg:"uses-permission android:name="android.permission.INTERNET"/uses-permission"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM