Node.js 如何在节点soap中使用派生类型

Node.js 如何在节点soap中使用派生类型,node.js,web-services,soap,node-soap,Node.js,Web Services,Soap,Node Soap,我正在使用节点Soap发送Soap请求并解析答案 现在我有了一个派生类型为的服务 如何在请求中指定xsi:type=“PersonalAddressDescription” 我就是这么做的 const args = { searchedAddress: { location: { street: 'Karl-Theorstraße 88', zip: '34234', city: 'Rummelshausen'

我正在使用节点Soap发送Soap请求并解析答案

现在我有了一个派生类型为
的服务

如何在请求中指定
xsi:type=“PersonalAddressDescription”

我就是这么做的

  const args = {
    searchedAddress: {
      location: {
        street: 'Karl-Theorstraße 88',
        zip: '34234',
        city: 'Rummelshausen'
      },
      firstName: 'Foo',
      lastName: 'Bar'
    }
  }

soap.createClient(WSDL, wsdlOptions, (err, client) => {
  client.getReport(args, (err, result) => {
    if (err !== null) {
      console.log(client.lastRequest)
      reject(err)
    }
    resolve(result)
  })
})
请求应该是这样的:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
 <soap:Header/>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <getReportRequest xmlns="http://www.service.com/superservice/v1.00">
      <searchedAddress xsi:type="PersonAddressDescription">
        <location>
          <street>Karl-Theorstraße 88</street>
          <zip>34234</zip>
          <city>Rummelshausen</city>
        </location>
        <firstName>Foo</firstName>
        <lastName>Bar</lastName>
      </searchedAddress>
    </getReportRequest>
  </s:Body>
</s:Envelope>

卡尔·托尔斯特拉88
34234
鲁梅尔肖森
福
酒吧

尝试向请求的节点添加
属性。从


这就是解决办法。很抱歉我没能赏金。我无法及时查看您的解决方案。
 const args = {
    searchedAddress: {
      attributes: {
        'xsi:type': 'PersonAddressDescription'
        },
      location: {
        street: 'Karl-Theorstraße 88',
        zip: '34234',
        city: 'Rummelshausen'
      },
      firstName: 'Foo',
      lastName: 'Bar'
    }
  }