如何解决如何使用本地wsdl文件发出soap请求? [Angular5]
我尝试使用wsdl文件通过soap信封发出xmlhttp请求。我找到了这段代码:
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('POST','../../assets/wsdl/wsdl.xml',true);
//the following variable contains my xml soap request (that you can get thanks to SoapUI for example)
var sr =
`<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="...">
<soapenv:Header>
</soapenv:Header>
<soapenv:Body>
<urn:login>
<urn:username>...</urn:username>
<urn:password>...</urn:password>
</urn:login>
</soapenv:Body>
</soapenv:Envelope>`;
xmlhttp.onreadystatechange = () => {
debugger;
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
var xml = xmlhttp.responseXML;//Here I'm getting the value contained by the <return> node
console.log(xml); //I'm printing my result square number
}
}
}
// Send the POST request
xmlhttp.setRequestHeader('Content-Type','text/xml');
xmlhttp.responseType = "document";
xmlhttp.send(sr);
但是它不起作用,消息为404错误:无法POST /assets/wsdl/wsdl.xml
我在寻找建议。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。