小编Swa*_*thy的帖子

node-soap客户端(Node.js)中数组字段的命名空间

如何为数组配置node-soap客户端集命名空间不仅适用于对象?

我对'sendPatient'方法的参数:

params = {
        patientCard: {
          patient: {
            firstName: 'test',
            lastName: 'test'
          },
          identifiers:
            {
              code: "123456789",
              codeType: 1
            }
        }
      };
client.sendPatient(params, ...)
Run Code Online (Sandbox Code Playgroud)

node-soap产品:

<soap:Envelope                                                     
  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"           
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"            
  xmlns:tns="http://xxx/patient/api/"     
  xmlns:bi="http://xxx/base/info/build/">              
  <soap:Header></soap:Header>                                      
  <soap:Body>                                                      
    <tns:sendPatient                                               
      xmlns:tns="http://xxx/patient/api/" 
      xmlns="http://xxx/patient/api/">    
      <tns:patientCard>                                            
        <ns1:patient                                               
          xmlns:ns1="http://xxx/patient/">
          <ns1:firstName>test</ns1:firstName>
          <ns1:lastName>test</ns1:lastName>                      
        </ns1:patient>                                             
        <ns1:identifiers                                           
          xmlns:ns1="http://xxx/patient/">
          <ns1:code>123456789</ns1:code>                         
          <ns1:codeType>1</ns1:codeType>                           
        </ns1:identifiers>                                         
      </tns:patientCard>                                           
    </tns:sendPatient>                                             
  </soap:Body>                                                     
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)

它的工作原理,但我需要发送标识符数组,而不仅仅是一个,所以当我放入数组时

params = {
        patientCard: {
          patient: {
            firstName: 'test',
            lastName: 'test'
          },
          identifiers: [
            {
              code: "123456789",
              codeType: 1
            }, {
              code: "987654321",
              codeType: 2
            }
          ]
        } …
Run Code Online (Sandbox Code Playgroud)

xml soap wsdl node.js node-soap

5
推荐指数
1
解决办法
4449
查看次数

标签 统计

node-soap ×1

node.js ×1

soap ×1

wsdl ×1

xml ×1