Node.js 如何使用nodejs soap创建wsdl soap请求
我使用node.js soap发送soap请求,但我一直收到错误 在SoapUI中,我的xml如下所示:Node.js 如何使用nodejs soap创建wsdl soap请求,node.js,xml,soap,wsdl,Node.js,Xml,Soap,Wsdl,我使用node.js soap发送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"> <soape
<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>
以下是错误:
a:内部故障
坏的Api密钥
有人能帮我吗?看来您必须为您的apiKey和orderId使用名称空间。您需要在您的soapclient sdk中了解如何设置名称空间我已使用强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.descripe()的返回:
)忘了提到我正在使用的ApiKey正在SoapUI上工作。根据github上的文档,我尝试将名称空间前缀添加到元素名acl:ApiKey、acl:OrderId和tem:args中。它会给我一个错误,说“acl/tem不可识别”。。。。。
"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));
});
});
{ CmsService:
{ BasicHttpBinding_ICmsService:
{ GetOrders: [Object], GetOrder: [Object] },
BasicHttpBinding_ICmsService1: { GetOrders: [Object], GetOrder: [Object] } } }