无法使用节点肥皂调用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 (将#修改为@)