gpt4 book ai didi

node.js - 如何使用nodejs SOAP 创建wsdl SOAP 请求

转载 作者:太空宇宙 更新时间:2023-11-04 00:21:02 25 4
gpt4 key购买 nike

我使用node.jssoap发送soap请求,但我不断收到错误。

在 SoapUI 中,我的 xml 如下所示:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:acl="http://schemas.datacontract.org/2004/07/Acl.WcfService.Model">
<soapenv:Header/>
<soapenv:Body>
<tem:GetOrder>
<!--Optional:-->
<tem:args>
<!--Optional:-->
<acl:ApiKey></acl:ApiKey>
<!--Optional:-->
<acl:OrderId></acl:OrderId>
</tem:args>
</tem:GetOrder>
</soapenv:Body>
</soapenv:Envelope>

这是我的代码:

var args = {
'args': {
'ApiKey' : '***',
'OrderId' : '***'
}
};

soap.createClient(wsdlURL, function (err, soapClient) {

soapClient.GetOrder(args, function (err, result) {
//the result goes here
if (err) {
console.log(err);
return;
}

console.log(result);

});
});

这是错误:

a:内部服务故障错误的 Api key

请有人帮我解决这个问题吗?

最佳答案

我用强力 SOAP 让它发挥作用。

这是代码:

"use strict";

var soap = require('strong-soap').soap;
var url = 'http://acldev.azurewebsites.net/CmsService.svc?singleWsdl';
var requestArgs = {
args: {
ApiKey : '***',
OrderId : '***'
}
};
var options = {};
soap.createClient(url, options, function(err, client) {
var method = client['CmsService']['BasicHttpBinding_ICmsService']['GetOrder'];
method(requestArgs, function(err, result, envelope, soapHeader) {
//response envelope
console.log('Response Envelope: \n' + envelope);
//'result' is the response body
console.log('Result: \n' + JSON.stringify(result));
});
});

(这是client.describe()的返回:

{ CmsService:
{ BasicHttpBinding_ICmsService:
{ GetOrders: [Object], GetOrder: [Object] },
BasicHttpBinding_ICmsService1: { GetOrders: [Object], GetOrder: [Object] } } }

)

关于node.js - 如何使用nodejs SOAP 创建wsdl SOAP 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44571355/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com