Pio*_*ski 4 xml soap wsdl soap-client node.js
我正在尝试使用node.js 中的node-soap使用this和this WSDLs定义的 SOAP WebService 。
现在,关于 singlewsdl 规范的这一部分:
<xs:element minOccurs="0" name="AuthToken" nillable="true" type="xs:string"/>
<xs:element xmlns:q1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" minOccurs="0" name="NIP" nillable="true" type="q1:ArrayOfstring"/>
...
<xs:element minOccurs="0" name="DateFrom" nillable="true" type="xs:dateTime"/>
Run Code Online (Sandbox Code Playgroud)
我使用 AuthToken 或 DateFrom 参数查询服务没有问题:
var args = {
AuthToken: 'yyyy',
DateFrom: (ISOstringed date variable)
};
Run Code Online (Sandbox Code Playgroud)
但我不知道“ArrayOf...”参数的语法应该是什么样子。我试过了:
NIP: 'xxxx'
NIP: {
element: 'xxxx'
}
NIP: {
string: 'xxxx'
}
Run Code Online (Sandbox Code Playgroud)
然而只有第一个会产生反序列化错误,前者只会产生超时(这与随机参数相同)。
任何帮助,将不胜感激。
SoapUI帮助我理解了这一点:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<soapenv:Header/>
<soapenv:Body>
<tem:GetData>
<tem:AuthToken>xxxx</tem:AuthToken>
<tem:NIP>
<arr:string>yyyy</arr:string>
<arr:string>zzzz</arr:string>
</tem:NIP>
</tem:GetData>
</soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)
是所需的 XML 请求格式,因此我将其设置为尽可能接近:
var args = {
attributes: {
'xmlns:arr': 'http://schemas.microsoft.com/2003/10/Serialization/Arrays'
},
'tns:AuthToken': 'xxxx',
'tns:NIP': {
'arr:string': ['yyyy','zzzz']
},
};
Run Code Online (Sandbox Code Playgroud)
作为评论的话 -默认情况下,node-soap将http://tempuri.org/命名空间定义为“tns”,因此我跳过了 SoapUI 建议的“tem”定义。
| 归档时间: |
|
| 查看次数: |
1484 次 |
| 最近记录: |