微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法使用节点肥皂调用wsdl函数

如何解决无法使用节点肥皂调用wsdl函数

我正在使用node-sopa包来调用远程WSDL方法。 我无法调用它给出以下错误方法:-

{"statusCode":500,"body":"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Header/><soap:Body><soap:Fault><faultcode>Client</faultcode><faultstring>UnkNown operation 'authentication' for service 'StoriesAPI'</faultstring></soap:Fault></soap:Body></soap:Envelope>","headers":{"server":"Nginx","date":"Sun,23 Aug 2020 11:15:42 GMT","content-type":"text/xml;charset=utf-8","transfer-encoding":"chunked","connection":"close","cache-control":"no-store"},"request":{"uri":{"protocol":"https:","slashes":true,"auth":null,"host":"sprintr.home.mendix.com","port":443,"hostname":"sprintr.home.mendix.com","hash":null,"search":null,"query":null,"pathname":"/ws/StoriesAPI","path":"/ws/StoriesAPI","href":"https://sprintr.home.mendix.com/ws/StoriesAPI"},"method":"POST","headers":{"User-Agent":"node-soap/0.33.0","Accept":"text/html,application/xhtml+xml,application/xml,text/xml;q=0.9,*/*;q=0.8","Accept-Encoding":"none","Accept-Charset":"utf-8","Connection":"close","Host":"sprintr.home.mendix.com","Content-Length":542,"Content-Type":"text/xml; charset=utf-8","SOAPAction":"\"http://home.mendix.com/storiesGetSprints\""}}}

请找到随附的代码:- code

import * as soap from "soap";
var platformPassword = 'PlatformAPIPassword';
var platformUsername = 'PlatformAPIUser';
var url = "https://docs.mendix.com/apidocs-mxsdk/apidocs/attachments/9535497/19398865.wsdl";
var requestArgs: any = null;
var options: any = {};

requestArgs = {
    ApiKey: "667271d9-1b1b-4056-8c3e-4de044e9e57e",ProjectID: "b1bdb9f4-d92f-4a0c-a469-b163d874df31"
};

let soapHeader: any = {
    authentication:
        { username: platformUsername,password: platformPassword }
};
soap.createClient(url,options,function (err,soapClient) {
    var method = soapClient['StoriesAPI']['StoriesAPIPort']['GetSprints'];
    soapClient.addSoapHeader({
        'authentication':
            { 'username': platformUsername,'password': platformPassword }
    },"","tns","http://home.mendix.com/stories");
    soapClient.GetSprints(requestArgs,function (err: any,result: any,envelope: any,soapHeader: any) {
        console.log(JSON.stringify(result));
    });
});

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。