To send an SOAP request via PhoneGap

Ebqpnhivosszg

New Member
I work on PhoneGap, trying to use some webservice. And I have referenced in api/jquery and example to write my SOAP request. It's just a simple case to test if the webservice will return the string "Hello World" and be assigned to the variable return_msg.\[code\]var return_msg; $(document).ready(function(){$(' #test_st_btn ').bind('click',function(){ var webServiceUrl = "http://x.x.x.x/StoryForMac/Service1.asmx?op=HelloWorld";//x.x.x.x is the url of the webserivce. var soapRequest = '<?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://x.x.x.x/StoryForMac/" >\ <msg>'+return_msg+'</msg>\</HelloWorld>\</soap:Body>\</soap:Envelope>';$.ajax({ type: "POST", rul: webServiceUrl, contentType: "text/xml", dataType: "xml", data: soapRequest, success: processSuccess, error: processError });});});function processSuccess(data,status,req){if(status=="success"){ return_msg= $(req.responseXML).find("HelloWorldResult").text(); alert("return_msg is:"+ return_msg);}}function processError(data,status,req){alert("Error");alert(req.responseText + " " + status);}\[/code\]The content of the webserivce(Service1.asmx)(written in C#):\[code\]public class Service1 : System.Web.Services.WebService{ [WebMethod] public string HelloWorld() { return "Hello World"; }}\[/code\]Finally, I got the error message: "undefined parsererror". Any suggestion? Thank u.
ps: I can't change the content of the webservice.
 
Back
Top