title: Node-soap: How to create a complex message with specific attributes?
body: <p>This is the message I need to send to <code>wsdl</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://WSDLPROVIDER" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;
      &lt;SOAP-ENV:Body&gt;
          &lt;ns1:enqueue&gt;
              &lt;domain xsi:type="xsd:string"&gt;STH&lt;/domain&gt;
              &lt;messageBodies SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array"&gt;
                  &lt;item xsi:type="xsd:string"&gt;STHE&lt;/item&gt;
              &lt;/messageBodies&gt;
              &lt;recipientNumbers SOAP-ENC:arrayType="xsd:string[2]" xsi:type="SOAP-ENC:Array"&gt;
                  &lt;item xsi:type="xsd:string"&gt;09xxxxxxxx&lt;/item&gt;
                  &lt;item xsi:type="xsd:string"&gt;09xxxxxxxx&lt;/item&gt;
              &lt;/recipientNumbers&gt;
              &lt;senderNumbers SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array"&gt;
                  &lt;item xsi:type="xsd:string"&gt;3000xxxxx&lt;/item&gt;
              &lt;/senderNumbers&gt;
              &lt;encodings xsi:nil="true" xsi:type="SOAP-ENC:Array" /&gt;
              &lt;udhs xsi:nil="true" xsi:type="SOAP-ENC:Array" /&gt;
              &lt;messageClasses xsi:nil="true" xsi:type="SOAP-ENC:Array" /&gt;
              &lt;priorities xsi:type="SOAP-ENC:Array" /&gt;
              &lt;checkingMessageIds SOAP-ENC:arrayType="xsd:long[2]" xsi:type="SOAP-ENC:Array"&gt;
                  &lt;item xsi:type="xsd:long"&gt;100&lt;/item&gt;
                  &lt;item xsi:type="xsd:long"&gt;101&lt;/item&gt;
              &lt;/checkingMessageIds&gt;
          &lt;/ns1:enqueue&gt;
      &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>And so far, I've made this:</p>
  
  <pre><code>var args = {
      domain: 'STHE',
      messageBodies: {
          item: {
              attributes: {
                  'xsi:type': 'xsd:string'
              },
              $value: "hi"
          }
      },
      "recipientNumbers": {
          attributes:{
              "SOAP-ENC:arrayType": "xsd:string[2]",
              "xsi:type": "SOAP-ENC:Array"
          },
          "item": {
              attributes:{
                  "xsi:type": "xsd:string"
              },
              $value: "09xxxxxx"
          }
      },
      "senderNumbers": {
          attributes:{
              "SOAP-ENC:arrayType": "xsd:string[1]",
              "xsi:type": "SOAP-ENC:Array"
          },
          "item": {
              attributes: {
                  "xsi:type": "xsd:string"
              },
              $value: "30xxxxx"
          }
  </code></pre>
  
  <p>Which results this:</p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:impl="WSDLPROVIDER" xmlns:intf="WSDLPROVIDER" xmlns:tns1="urn:SOAPSmsQueue"&gt;
      &lt;soap:Header&gt;&lt;/soap:Header&gt;
      &lt;soap:Body&gt;
          &lt;impl:enqueue&gt;
              &lt;domain&gt;STHE&lt;/domain&gt;
              &lt;messageBodies&gt;
                  &lt;item xsi:type="xsd:string"&gt;hi&lt;/item&gt;
              &lt;/messageBodies&gt;
              &lt;recipientNumbers&gt;
                  &lt;item xsi:type="xsd:string"&gt;09xxxxxx&lt;/item&gt;
              &lt;/recipientNumbers&gt;
              &lt;senderNumbers&gt;
                  &lt;item xsi:type="xsd:string"&gt;30xxxxx&lt;/item&gt;
              &lt;/senderNumbers&gt;
          &lt;/impl:enqueue&gt;
      &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>I tried to use attributes on <code>messageBodies</code> part, but any combination I used failed with no change in the output. </p>
  
  <p>Is there any way to pass the message in <code>XML</code> instead of <code>Json</code> interface?</p>
  
  <p>Any help will be appreciated. </p>