我很难用node-soap和chronopost(运输平台(肥皂api提出一个简单的请求。
我做的第一件事是遵循基本的节点肥皂示例,但它只是惨败,而计时邮报没有任何真正有用的错误。
这是我所拥有的:
const soap = require('soap')
const client = await soap.createClientAsync(
'https://ws.chronopost.fr/shipping-cxf/ShippingServiceWS?wsdl'
)
client.shippingV6(...somedata, (err, result) => {
if (err) {
return handleErr(); // it always fails
}
handleResult();
})
经过多次尝试,似乎 chronopost api 使用特殊的根属性(谁知道为什么(,您需要在节点肥皂上制作真正满足他们需求的选项(耶......
这是对我有用的东西
const createClientShippingServiceWS = async () => {
const wsdlOptions = {
envelopeKey: 'soapenv',
overrideRootElement: {
namespace: 'cxf',
xmlnsAttributes: [
{
name: 'xmlns:cxf',
value: 'http://cxf.shipping.soap.chronopost.fr/'
}
]
}
}
return await soap.createClientAsync(
'https://ws.chronopost.fr/shipping-cxf/ShippingServiceWS?wsdl',
wsdlOptions
)
}
另外,如果节点肥皂无法事件弄清楚如何做出响应,那么获取 wsdl 有什么意义?
感谢 chronopost 被困在 2008 年