Parsing XML from SOAP response with jQuery -
i have problems parsing response soap server jquery.
this request
post /remedifinderservices/hswebservice.asmx http/1.1 host: 192.168.1.24 content-type: text/xml; charset=utf-8 content-length: length soapaction: "http://www.healthsprint.com/newuserregistration" <?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> <newuserregistration xmlns="http://www.healthsprint.com"> <loginid>string</loginid> <password>string</password> </newuserregistration> </soap:body> </soap:envelope>
and response
http/1.1 200 ok content-type: text/xml; charset=utf-8 content-length: length <?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> <newuserregistrationresponse xmlns="http://www.healthsprint.com"> <newuserregistrationresult>int</newuserregistrationresult> </newuserregistrationresponse> </soap:body> </soap:envelope>
and code
$("#signup_btn").click(function (event) { var fornewurl = "http://192.168.1.24/remedifinderservices/hswebservice.asmx?op=newuserregistration"; var newforsoaprequest = '<?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> \ <newuserregistration xmlns="http://www.healthsprint.com"> \ <loginid>' + $(".user").val() + '</loginid> \ <password>' + $(".pwd").val() + '</password> \ </newuserregistration> \ </soap:body> \ </soap:envelope>'; $.ajax({ type: "post", url: fornewurl, contenttype: "text/xml", datatype: "xml", data: newforsoaprequest, success: newprocesssuccess, error: newprocesserror }); function newprocesssuccess(data, status, req) { if (status == "success") $(".u_name").text($(req.responsexml).find("loginid").text()); } function newprocesserror(data, status, req) { alert(req.responsetext + " " + status); } });
i need send data login id , password , need display login id other page somehow not working here.
even how check data has sent web service or not
thanks in advance
i not sure understand question soap xml. suppose use xml parser identify respective xml element , use further.
hope helped!
Comments
Post a Comment