0
我必須從JS調用WS操作。我在JS-寫了下面的代碼無法通過Javascript從URL調用Web服務
function fnCallWS()
{ alert("Inside function");
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "http://10.216.46.185:7014/XYZService/XYZService", true);
xmlhttp.setRequestHeader("Content-Type", "text/xml");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
alert(xmlhttp.responseText);
}
}
var sr = '<?xml version="1.0" encoding="utf-8"?>'+'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'+
'<soap:Body>'+
'<ns1:XYZOPERATION_IOFS_REQ xmlns:ns1="http://abc.xyz.com/service/XYZService">'+
'<ns1:Application-Details-IO>'+
'<ns1:LEADID>ORTEST1</ns1:LEADID>'+
'</ns1:Application-Details-IO>'+
'</ns1:XYZOPERATION_IOFS_REQ>'+
'</soap:Body>'+'</soap:Envelope>';
xmlhttp.send(sr);
}
我的WSDL的URL是這樣的 - http://10.216.46.185:7014/XYZService/XYZService?WSDL 我想不出我在做什麼錯了,因爲我已經提到了各種例子,在很多例子中,同樣的方法是用過的。 而我的web服務被正確寫入,因爲我可以在使用SoapUI工具調用時得到響應。
什麼問題?錯誤?錯誤的輸出? CORS問題? – csmckelvey
我發現在JS調試沒有錯誤。並且服務器上沒有日誌,所以大多數webservice沒有被擊中。 –