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没有被击中。 –