title: Assigning a value to a nested xml when using the SOAP npm library
body: <p>I have been able to successfully invoke a web service call using in the soap npm library (<a href="https://www.npmjs.com/package/soap" rel="nofollow noreferrer">https://www.npmjs.com/package/soap</a>)</p>
  
  <p>What I want is to be able to assign values as I have been doing and then call the web service but I think that this will not work as there are repeating XML structures and how do I map my value i.e. <code>&lt;adl:stops&gt;</code> - There could be more than one stop so how does soap npm handle this.</p>
  
  <p>The documentation does not seem to tell me how to create a JSON structure that will allow me to assign values for the web service call.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>I am using node.js to create a call </p>
  
  <p>My code is :</p>
  
  <pre><code>var url = 'https://preprod.blackcab.ro/external-ws/adler/wsdl';
      var args = {
        login: 'xxxxxxx',
        password: 'xxxxxxxx'
      };
  
      var p = new Promise(function (resolve, reject) {
  
        console.log('....start');
        soap.createClient(url, function (err, client) {
          if (err) {
            console.log('..error', err);
            throw new Error(err);
          } else {
  
            client.Login(args, function (err, result) {
              if (err) {
                console.log('&gt; error = ', err);
                reject();
              } else {
                console.log('&gt;result = ', result);
                resolve(result);
              }
  
            });
          }
        });
      }); // promise
  
      return p;
  </code></pre>
  
  <p>The service is defined as </p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:adl="http://www.haulmont.com/sherlock/adler"&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;adl:LoginRequest&gt;
           &lt;adl:login&gt;?&lt;/adl:login&gt;
           &lt;adl:password&gt;?&lt;/adl:password&gt;
        &lt;/adl:LoginRequest&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>That was quite easy... now I am having difficulties calling a nested xml function defintion i.e.</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:adl="http://www.haulmont.com/sherlock/adler"&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;adl:QuotationRequest&gt;
           &lt;adl:sessionId&gt;?&lt;/adl:sessionId&gt;
           &lt;!--Optional:--&gt;
           &lt;adl:retailSessionId&gt;?&lt;/adl:retailSessionId&gt;
           &lt;adl:job&gt;
              &lt;adl:accountNumber&gt;?&lt;/adl:accountNumber&gt;
              &lt;!--Optional:--&gt;
              &lt;adl:pin&gt;?&lt;/adl:pin&gt;
              &lt;!--Optional:--&gt;
              &lt;adl:caller&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:individualId&gt;?&lt;/adl:individualId&gt;
                 &lt;adl:name&gt;?&lt;/adl:name&gt;
              &lt;/adl:caller&gt;
              &lt;adl:asap&gt;?&lt;/adl:asap&gt;
              &lt;adl:serviceCode&gt;?&lt;/adl:serviceCode&gt;
              &lt;!--Optional:--&gt;
              &lt;adl:jobDate&gt;?&lt;/adl:jobDate&gt;
              &lt;adl:paymentType&gt;?&lt;/adl:paymentType&gt;
              &lt;!--Optional:--&gt;
              &lt;adl:numberOfPassengers&gt;?&lt;/adl:numberOfPassengers&gt;
              &lt;!--Optional:--&gt;
              &lt;adl:deadline&gt;?&lt;/adl:deadline&gt;
              &lt;adl:routeInfo&gt;
                 &lt;adl:destinationUnknown&gt;?&lt;/adl:destinationUnknown&gt;
                 &lt;adl:waitAndReturn&gt;?&lt;/adl:waitAndReturn&gt;
                 &lt;adl:asDirected&gt;?&lt;/adl:asDirected&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:asDirectedHours&gt;?&lt;/adl:asDirectedHours&gt;
              &lt;/adl:routeInfo&gt;
              &lt;!--Optional:--&gt;
              &lt;adl:promoCode&gt;?&lt;/adl:promoCode&gt;
              &lt;!--Optional:--&gt;
              &lt;adl:creditCard&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:id&gt;?&lt;/adl:id&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:startDate&gt;?&lt;/adl:startDate&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:expiryDate&gt;?&lt;/adl:expiryDate&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:holderName&gt;?&lt;/adl:holderName&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:number&gt;?&lt;/adl:number&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:cvcNumber&gt;?&lt;/adl:cvcNumber&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:issueNumber&gt;?&lt;/adl:issueNumber&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:billingAddress&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:country&gt;?&lt;/adl:country&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:street&gt;?&lt;/adl:street&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:streetNumber&gt;?&lt;/adl:streetNumber&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:town&gt;?&lt;/adl:town&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:postcode&gt;?&lt;/adl:postcode&gt;
                 &lt;/adl:billingAddress&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:encryptedDetails&gt;?&lt;/adl:encryptedDetails&gt;
              &lt;/adl:creditCard&gt;
              &lt;!--Zero or more repetitions:--&gt;
              &lt;adl:actors&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:individualId&gt;?&lt;/adl:individualId&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:name&gt;?&lt;/adl:name&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:telephone&gt;?&lt;/adl:telephone&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:email&gt;?&lt;/adl:email&gt;
                 &lt;adl:type&gt;?&lt;/adl:type&gt;
              &lt;/adl:actors&gt;
              &lt;!--Zero or more repetitions:--&gt;
              &lt;adl:references&gt;
                 &lt;adl:entityName&gt;?&lt;/adl:entityName&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:value&gt;?&lt;/adl:value&gt;
              &lt;/adl:references&gt;
              &lt;!--Zero or more repetitions:--&gt;
              &lt;adl:specialInstructions&gt;
                 &lt;adl:typeCode&gt;?&lt;/adl:typeCode&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:value&gt;?&lt;/adl:value&gt;
              &lt;/adl:specialInstructions&gt;
              &lt;!--Zero or more repetitions:--&gt;
              &lt;adl:stops&gt;
                 &lt;adl:operationType&gt;?&lt;/adl:operationType&gt;
                 &lt;adl:address&gt;
                    &lt;adl:formattedAddress&gt;?&lt;/adl:formattedAddress&gt;
                    &lt;adl:latitude&gt;?&lt;/adl:latitude&gt;
                    &lt;adl:longitude&gt;?&lt;/adl:longitude&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:field0&gt;?&lt;/adl:field0&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:field1&gt;?&lt;/adl:field1&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:field2&gt;?&lt;/adl:field2&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:field3&gt;?&lt;/adl:field3&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:field4&gt;?&lt;/adl:field4&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:field5&gt;?&lt;/adl:field5&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:field6&gt;?&lt;/adl:field6&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:field7&gt;?&lt;/adl:field7&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:field8&gt;?&lt;/adl:field8&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:field9&gt;?&lt;/adl:field9&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:field10&gt;?&lt;/adl:field10&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:field11&gt;?&lt;/adl:field11&gt;
                 &lt;/adl:address&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:contact&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:individualId&gt;?&lt;/adl:individualId&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:name&gt;?&lt;/adl:name&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:telephone&gt;?&lt;/adl:telephone&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:email&gt;?&lt;/adl:email&gt;
                 &lt;/adl:contact&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:airportDetails&gt;
                    &lt;adl:airportCode&gt;?&lt;/adl:airportCode&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:terminalCode&gt;?&lt;/adl:terminalCode&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:flightNumber&gt;?&lt;/adl:flightNumber&gt;
                    &lt;adl:eta&gt;?&lt;/adl:eta&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:pickupTimeDelay&gt;?&lt;/adl:pickupTimeDelay&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:airline&gt;?&lt;/adl:airline&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:arrivalFrom&gt;?&lt;/adl:arrivalFrom&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:meetingPoint&gt;?&lt;/adl:meetingPoint&gt;
                 &lt;/adl:airportDetails&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:trainDetails&gt;
                    &lt;adl:trainStation&gt;?&lt;/adl:trainStation&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:meetingPoint&gt;?&lt;/adl:meetingPoint&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:pickupTimeDelay&gt;?&lt;/adl:pickupTimeDelay&gt;
                    &lt;adl:eta&gt;?&lt;/adl:eta&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:arrivalFrom&gt;?&lt;/adl:arrivalFrom&gt;
                    &lt;!--Optional:--&gt;
                    &lt;adl:trainNumber&gt;?&lt;/adl:trainNumber&gt;
                 &lt;/adl:trainDetails&gt;
                 &lt;!--Optional:--&gt;
                 &lt;adl:notes&gt;?&lt;/adl:notes&gt;
              &lt;/adl:stops&gt;
           &lt;/adl:job&gt;
        &lt;/adl:QuotationRequest&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>