Syd Amir
Syd Amir

Reputation: 475

set some property for array type element in node soap

i get xml like this when using node-soap in my app :

<?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>

so i want's to add some property to array elements. some property like this : soapenc:arrayType="soapenc:string[1]" xsi:type="soapenc:Array" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

and create array element like this :

  <messageBodies soapenc:arrayType="soapenc:string[1]" xsi:type="soapenc:Array" 
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" >
    <messageBodies>hi</messageBodies>
  </messageBodies>

finally i want my xml are look like this :

<?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>

this description just for silly validation in stackoverflow for this question is looks like your post is mostly code ...

Upvotes: 0

Views: 2187

Answers (1)

Bruno Carletti
Bruno Carletti

Reputation: 273

Try this:

  <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 instead of soapenc

Upvotes: 1

Related Questions