[英]How to use derived types in node-soap
我正在使用Node Soap https://github.com/vpulim/node-soap發送SOAP請求並解析答案。
現在,我有一個具有派生類型<searchedAddress xsi:type="PersonAddressDescription">
。
如何在請求中指定xsi:type="PersonAddressDescription"
?
這就是我所做的
const args = {
searchedAddress: {
location: {
street: 'Karl-Theorstraße 88',
zip: '34234',
city: 'Rummelshausen'
},
firstName: 'Foo',
lastName: 'Bar'
}
}
soap.createClient(WSDL, wsdlOptions, (err, client) => {
client.getReport(args, (err, result) => {
if (err !== null) {
console.log(client.lastRequest)
reject(err)
}
resolve(result)
})
})
該請求應如下所示:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<soap:Header/>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<getReportRequest xmlns="http://www.service.com/superservice/v1.00">
<searchedAddress xsi:type="PersonAddressDescription">
<location>
<street>Karl-Theorstraße 88</street>
<zip>34234</zip>
<city>Rummelshausen</city>
</location>
<firstName>Foo</firstName>
<lastName>Bar</lastName>
</searchedAddress>
</getReportRequest>
</s:Body>
</s:Envelope>
嘗試將attributes
添加到您請求的節點。 從這里
const args = {
searchedAddress: {
attributes: {
'xsi:type': 'PersonAddressDescription'
},
location: {
street: 'Karl-Theorstraße 88',
zip: '34234',
city: 'Rummelshausen'
},
firstName: 'Foo',
lastName: 'Bar'
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.