我一直在和之间切换node-soap
,strong-soap
因为它们都生成不同的有效负载并且工作相似(我所要做的就是更改需求路径,我可以在strong-soap
和node-soap
不更改现有代码之间切换)
但是,当我使用 时,我node-soap
并没有真正生成这些奇怪的有效载荷。
这是一个例子
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:i0="http://services.redacted.com/Contracts" xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:tns="http://services.redacted.com/Contracts" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<stns:SecurityToken xmlns:stns="http://services.redacted.com/Security">
<ServiceKey>123</ServiceKey>
<UserId>123</UserId>
<Username>123</Username>
<Password>123</Password>
</stns:SecurityToken>
</soap:Header>
<soap:Body>
<DataService_GetProfiles_InputMessage />
</soap:Body>
</soap:Envelope>
所以一切都很好,除了我试图调用的方法被调用:GetProfiles
不是DataService_GetProfiles_InputMessage
,随后我试图与之通信的服务无法识别我试图调用的方法。
什么起作用(以及strong-soap
产生什么)
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:i0="http://services.redacted.com/Contracts" xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:tns="http://services.redacted.com/Contracts" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<stns:SecurityToken xmlns:stns="http://services.redacted.com/Security">
<ServiceKey>123</ServiceKey>
<UserId>123</UserId>
<Username>123</Username>
<Password>123</Password>
</stns:SecurityToken>
</soap:Header>
<soap:Body>
<GetProfiles />
</soap:Body>
</soap:Envelope>
现在这是有道理的。但是,由于其他限制,我们不能坚持strong-soap
.
有没有办法可以覆盖请求的有效负载?它生成这个奇怪的 XML 有什么原因吗?
我的代码:
this.dataClientConnection.DataService.BasicHttpBinding_DataService.GetProfiles()