function CreateXMLHttpRequest() {
if (typeof XMLHttpRequest != "undefined") {
//All modern browsers (IE7+, Firefox, Chrome, Safari, and Opera) uses XMLHttpRequest object
return new XMLHttpRequest();
}
else if (typeof ActiveXObject != "undefined") {
//Internet Explorer (IE5 and IE6) uses an ActiveX Object
return new ActiveXObject("Microsoft.XMLHTTP");
else {
throw new Error("XMLHttpRequestnot supported");
var objXMLHttpRequest = CreateXMLHttpRequest();
objXMLHttpRequest.open("method", "<serviceUrl>", isAsync);
objXMLHttpRequest.onreadystatechange = function () {
if (objXMLHttpRequest.readyState == 4 && objXMLHttpRequest.status == 200) {
result = objXMLHttpRequest.responseXML;
objXMLHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
var packet = '<?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>\
<WebMethodName xmlns="<Webservice Namespace>">\
<ParameterName>value</ParameterName >\
</WebMethodName>\
</soap:Body>\
</soap:Envelope>';
objXMLHttpRequest.send(packet);
// Add mentioned below code only if your application calls webservice synchronously. Otherwise use "onreadystatechange" process response.
response = objXMLHttpRequest.responseXML;