The protocol is definitely using the HTTP protocol, because the SOAP protocol itself is also based on the HTTP protocol. Interim second way: Only webservice3.5 later version can be successful
The first way: to construct the body of the SOAP format, pay attention to the bold yellow logo, for example:
Createxmlhttprequest ();
var data;
data = ' <?xml version= ' 1.0 "encoding=" Utf-8 "?>";
data = Data + ' <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/">";
data = data + "<soap:Header>"
data = Data + ' <usersoapheader xmlns= ' http://tempuri.org/' > '
data = data + "<UserName>admin</UserName>"
data = data + "<Pwd>faaaa</Pwd>"
data = data + "</UserSoapHeader>"
data = data + "</soap:Header>"
data = data + ' <soap:Body> ';
data = data + ' < ' +method+ ' xmlns= "' +_namespace+ '" > ";
for (Var i=0;i<variable.length;i++)
{
data = data + ' < ' +variable[i]+ ' > ' +value[i]+ ' </' +variable[i]+ ' > ';
}
data = data + ' </' +method+ ' > ';
data = data + ' </soap:Body> ';
data = data + ' </soap:Envelope> ';
Xmlhttp.onreadystatechange=handlestatechange;
xmlHTTP. Open ("POST", url, True);
XMLHTTP. setRequestHeader ("Content-type", "Text/xml; Charset=utf-8");
XMLHTTP. setRequestHeader ("Content-length", Getlen (data));
XMLHTTP. setRequestHeader ("SOAPAction", _namespace+method);
xmlHTTP. Send (data);
The second way (I didn't use it, I thought it wouldn't work): Constructs a JSON-formatted body, such as:
Createxmlhttprequest ();
URL : Http://....../a.asmx/webservice Method Name
Body using JSON data format
XMLHTTP. setRequestHeader ("Content-type", "application/json; Charset=utf-8");
XMLHTTP. setRequestHeader ("Content-length", Getlen (body));
JS Call WebService two ways