在我的app中使用node-soap时,我得到这样的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:impl="http://magfa.com/soap/SOAPSmsQueue"
xmlns:intf="http://magfa.com/soap/SOAPSmsQueue"
xmlns:tns1="urn:SOAPSmsQueue">
<soap:Header></soap:Header>
<soap:Body>
<impl:enqueue>
<domain>magfa</domain>
<messageBodies>
<messageBodies>hi</messageBodies>
</messageBodies>
<recipientNumbers>
<recipientNumbers>989187004197</recipientNumbers>
</recipientNumbers>
<senderNumbers>
<senderNumbers>98300079368</senderNumbers>
</senderNumbers>
</impl:enqueue>
</soap:Body>
</soap:Envelope>
所以我想要为数组元素添加一些属性。
这样的一些属性:soapenc:arrayType="soapenc:string[1]" xsi:type="soapenc:Array" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
并创建如下的数组元素:
<messageBodies soapenc:arrayType="soapenc:string[1]" xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" >
<messageBodies>hi</messageBodies>
</messageBodies>
最后我希望我的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:impl="http://magfa.com/soap/SOAPSmsQueue"
xmlns:intf="http://magfa.com/soap/SOAPSmsQueue"
xmlns:tns1="urn:SOAPSmsQueue">
<soap:Header></soap:Header>
<soap:Body>
<impl:enqueue>
<domain>magfa</domain>
<messageBodies soapenc:arrayType="soapenc:string[1]" xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" >
<messageBodies>hi</messageBodies>
</messageBodies>
<recipientNumbers soapenc:arrayType="soapenc:string[1]" xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" >
<recipientNumbers>989381028800</recipientNumbers>
</recipientNumbers>
<senderNumbers soapenc:arrayType="soapenc:string[1]" xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<senderNumbers >98300079368</senderNumbers>
</senderNumbers>
</impl:enqueue>
</soap:Body>
</soap:Envelope>
此描述仅适用于此问题is looks like your post is mostly code ...
答案 0 :(得分:0)
试试这个:
<messageBodies soap-enc:arrayType="xsd:string[1]" xsi:type="soap-enc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" >
<messageBodies>hi</messageBodies>
</messageBodies>
soap-enc而不是soapenc