Bonsoir a tous
je suis en train de consomme un web service avec JavaScript, je tester cette solution, mais je peux pas comprend quelque ligne de code alors S.V.P. qui pe m'aider a explique a qoid sert chaque ligne souligne de se code
Merci
Cordialement.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

function envoyer(){
var xmlhttp
if ( typeof XMLHttpRequest == "object" ) {
xmlhttp = new XMLHttpRequest();
}
if ( typeof ActiveXObject == "object" || typeof ActiveXObject == "function") {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}

xmlhttp.open("POST", "http://localhost:8080/testWebService/WebService1?Tester",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
alert(xmlhttp.responseText)
}
}

xmlhttp.setRequestHeader("MessageType", "CALL")
xmlhttp.setRequestHeader("Content-Type", "text/xml")

var miSoap=
'<?xml version="1.0" encoding="UTF-8"?> \n' +

'<soap:Envelope\n' +
'xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"\n'+
'xmlns:ns1="WebService1"\n'+
'>\n'+
'<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/wsdl/">\n'+
'<ns1:bonjour>\n'+
'</ns1:bonjour> \n' +
'</soap:Body> \n' +
'</soap:Envelope>';

alert(miSoap);
xmlhttp.send(miSoap);
}