Node.js SOAP call with complex types

I'm currently trying to use node-soap ( https://github.com/milewise/node-soap ) to make .net SOAP server authorization calls. However, I cannot force the client code to pass the correct parameters. I know that the function calls the server since I get a server error response.

When I look at WSDL, I notice that ComplexType parameters are required to invoke the server. Is there a way to create ComplexTypes that I need, or can I just use Javascript objects? Here is my current code:

  var soap = require('soap');

  var url = 'https://api.authorize.net/soap/v1/Service.asmx?WSDL';

  soap.createClient(url, function(err, client) {

  var args = {
      merchantAuthentication: {
        name: '285tUPuS',
        transactionKey: '58JKJ4T95uee75wd'
      }
  };

  client.Service.ServiceSoap12.GetTransactionDetails(args, 
      function(err, result) {

          if (err) {
            console.log(err);
          } else {
            console.log(result.GetTransactionDetailsResult[0].messages);
          }
      });

});

+5
source share
1 answer

node -soap JavaScript XML . xml, wsdl. , node -soap , ( , node -sapap wsdl):

wsdl API CyberSource

<data:requestMessage xmlns:data="urn:schemas-cybersource-com:transaction-data-1.93" xmlns="urn:schemas-cybersource-com:transaction-data-1.93">

  <data:merchantAuthentication>
    <data:name>285tUPuS</data:name>
    <data:transactionKey>58JKJ4T95uee75wd</data:transactionKey>
  </data:merchantAuthentication>

</data:requestMessage>

, , api Authorize.net, , , , , , :

client.setSecurity(new soap.WSSecurity('username’, ‘password’));
+1

All Articles