我有一个网络服务,我正在尝试使用节点肥皂进行调用。当我需要使用数组进行调用时,在生成的XML中得到了更多的帮助
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns5="http://com.tch.cards.service/types/arrays/com/tch/cards/model" xmlns:tns="http://com.tch.cards.service" xmlns:ns2="http://com.tch.cards.service/types" xmlns:ns4="http://com.tch.cards.service/types/arrays/" xmlns:ns3="http://com.tch.cards.service/types/arrays/java/lang">
<soap:Body>
<tns:getTransLocations>
<clientId>XXXXXXXXXXXXXXXXXXXXX</clientId>
<locationIds>
<tns:locationIds>
<value>599996</value>
<value>599998</value>
</tns:locationIds>
</locationIds>
</tns:getTransLocations>
</soap:Body>
</soap:Envelope>
上面的问题是</tns:locationIds>
元素。我需要的是看起来像这样的XML
<locationIds>
<value>599996</value>
<value>599998</value>
</locationIds>
这是我用来生成调用的js代码
let client = await soap.createClientAsync(url,{namespaceArrayElements:false});
var id = [{value:'599996'}, {value:'599998'}];
let args = {
clientId:this.token,
'locationIds':id,
}
let result = await this.client.getTransLocationsAsync(args)
答案 0 :(得分:0)
我实际上无法测试,但是我会尝试类似的
let client = await soap.createClientAsync(url,{namespaceArrayElements:false});
let args = {
clientId:this.token,
locationIds: {
value: [599996, 599998]
}
}
let result = await client.getTransLocationsAsync(args);