I have problems parsing response from SOAP server with jQuery.
this is 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 this is the 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 this is my 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 to send the data to login id and password and need to display login id to other page but somehow its not working here.
Even how i will check that data has sent to web service or not
thanks in advance
I am not sure I understand the question fully but SOAP is XML. I suppose you could use an XML Parser to identify the respective XML element and use it further.
Hope I helped!