title: How to use derived types in node-soap
body: <p>I'm using Node Soap <a href="https://github.com/vpulim/node-soap" rel="nofollow noreferrer">https://github.com/vpulim/node-soap</a> to send SOAP requests and parse the answers.</p>
  
  <p>Now I've got a service which has a derived type <code>&lt;searchedAddress xsi:type="PersonAddressDescription"&gt;</code>.</p>
  
  <p><strong><em>How do I specify the <code>xsi:type="PersonAddressDescription"</code> in my request?</em></strong></p>
  
  <p><strong>This is what I do</strong></p>
  
  <pre><code>  const args = {
      searchedAddress: {
        location: {
          street: 'Karl-Theorstraße 88',
          zip: '34234',
          city: 'Rummelshausen'
        },
        firstName: 'Foo',
        lastName: 'Bar'
      }
    }
  
  soap.createClient(WSDL, wsdlOptions, (err, client) =&gt; {
    client.getReport(args, (err, result) =&gt; {
      if (err !== null) {
        console.log(client.lastRequest)
        reject(err)
      }
      resolve(result)
    })
  })
  </code></pre>
  
  <p><strong>This is how the request is supposed to look like:</strong></p>
  
  <pre><code>&lt;s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"&gt;
   &lt;soap:Header/&gt;
    &lt;s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;getReportRequest xmlns="http://www.service.com/superservice/v1.00"&gt;
        &lt;searchedAddress xsi:type="PersonAddressDescription"&gt;
          &lt;location&gt;
            &lt;street&gt;Karl-Theorstraße 88&lt;/street&gt;
            &lt;zip&gt;34234&lt;/zip&gt;
            &lt;city&gt;Rummelshausen&lt;/city&gt;
          &lt;/location&gt;
          &lt;firstName&gt;Foo&lt;/firstName&gt;
          &lt;lastName&gt;Bar&lt;/lastName&gt;
        &lt;/searchedAddress&gt;
      &lt;/getReportRequest&gt;
    &lt;/s:Body&gt;
  &lt;/s:Envelope&gt;
  </code></pre>