//Calling custom web service using java script
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
var soapXml = "<?xml version='1.0' encoding='utf-8'?>";
soapXml += "<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/'>";
soapXml += "<soap:Body>";
soapXml += "<GetObjectTypeCode xmlns='http://tempuri.org/'>";
soapXml += " <Entity>" + entityname + "</Entity>";
soapXml += " </GetObjectTypeCode>";
soapXml += " </soap:Body>";
soapXml += "</soap:Envelope>";
xmlhttp.open("POST", "/customwebserviceurl.asmx", false);
xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlhttp.setRequestHeader("Content-Length", soapXml.length);
xmlhttp.setRequestHeader("SOAPAction", "http://tempuri.org/GetObjectTypeCode");
xmlhttp.send(soapXml);
var resultValue = xmlhttp.responseXML.childNodes[1].nodeTypedValue;
No comments:
Post a Comment