简体   繁体   English

在Phonegap中使用JQuery调用基于SOAP的Web服务

[英]Call a SOAP based web-service using JQuery in Phonegap

I have a big problem regarding to call a web-service through Jquery . 我有一个关于通过Jquery调用Web服务的大问题。

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. 我现在正在开发一个与Android应用 程序相同的phonegap应用 程序 ,因为我必须调用一个Web服务并从那里获取数据,我试图以自己的方式解决它,但没有找到合适的解决方案。

My web-service is built in .NET using SOAP . 我的Web服务使用SOAP.NET中构建的 And now i want to call that web-service through my HTML page using jquery . 现在,我想使用jquery通过我的HTML页面调用该Web服务。 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 您可以使用XMLHttpRequest与外部域连接,这是示例代码

      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". 注意:可以访问config.xml中的域,例如:access origin =“ http://somedmain.com”。 Add user INTERNET permission in AndroidManifest.xml eg:"uses-permission android:name="android.permission.INTERNET"/uses-permission" 在AndroidManifest.xml中添加用户INTERNET权限,例如:“ uses-permission android:name =” android.permission.INTERNET“ / uses-permission”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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