[AJAX] XMLHttpRequest Status 0
Bonjour tout le monde je suis en train de créer une fonction JavaScript pour consommer un web service SOAP, lors de l'exécution de fonction (en local sur Wamp Server), elle m'afficher le status = 0, qui peut m'aider qu' est ce que je dois faire S.V.P
Code:
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 38 39
| function envoyer(){
var xmlhttp
if(window.XMLHttpRequest) // Firefox
xmlhttp = new XMLHttpRequest();
else if(window.ActiveXObject) // Internet Explorer
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
else { // XMLHttpRequest non supporté par le navigateur
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
return;
}
if ( typeof ActiveXObject == "object" || typeof ActiveXObject == "function") {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
xmlhttp.open("POST", "localhost:8080/testWebService/WebService1?Tester",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
alert(xmlhttp.status)
}
}
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>';
xmlhttp.send(miSoap);
} |