如何使用本地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 (将#修改为@)