Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to understand node-soap "describe" function?

Tags:

soap

node.js

I'm attempting to use the node SOAP npm module(https://github.com/vpulim/node-soap) service.

var soap = require('soap');
var soapWSDL = "https://webservice.s7.exacttarget.com/etframework.wsdl";

soap.createClient(soapWSDL, function (err, client) {
    if (err) {
      return callback(err, null);
    }

    client.setSecurity(new soap.WSSecurity(self.username, self.password));

    console.log("describe", client.describe());
    console.log("retrieve", client.describe().PartnerAPI.Soap.Retrieve);
});

The first log shows the available methods...

But i'm trying to understand the exact format required for params from the second console.log...

More specifically, when i call client.Retrieve(options,function(e,r){}); what is the required format of options supposed to be?

Here is the output from the two console.logs

Describe:

 { PartnerAPI: 
   { Soap: 
      { Create: [Object],
        Retrieve: [Object],
        Update: [Object],
        Delete: [Object],
        Query: [Object],
        Describe: [Object],
        Execute: [Object],
        Perform: [Object],
        Configure: [Object],
        Schedule: [Object],
        VersionInfo: [Object],
        Extract: [Object],
        GetSystemStatus: [Object] } } }

Retrieve:

 { input: 
   { RetrieveRequest: 
      { 'ClientIDs[]': [Object],
        ObjectType: 'xsd:string',
        'Properties[]': 'xsd:string',
        Filter: [Object],
        'RespondTo[]': [Object],
        'PartnerProperties[]': [Object],
        ContinueRequest: 'xsd:string',
        QueryAllAccounts: 'xsd:boolean',
        RetrieveAllSinceLastBatch: 'xsd:boolean',
        RepeatLastResult: 'xsd:boolean',
        Retrieves: [Object],
        Options: [Object],
        targetNSAlias: 'tns',
        targetNamespace: 'http://exacttarget.com/wsdl/partnerAPI' } },
  output: 
   { OverallStatus: 'xsd:string',
     RequestID: 'xsd:string',
     'Results[]': 
      { Client: [Object],
        PartnerKey: 'xsd:string',
        'PartnerProperties[]': [Object],
        CreatedDate: 'xsd:dateTime',
        ModifiedDate: 'xsd:dateTime',
        ID: 'xsd:int',
        ObjectID: 'xsd:string',
        CustomerKey: 'xsd:string',
        Owner: [Object],
        CorrelationID: 'xsd:string',
        ObjectState: 'xsd:string',
        targetNSAlias: 'tns',
        targetNamespace: 'http://exacttarget.com/wsdl/partnerAPI' } } }
like image 771
Blair Anderson Avatar asked Aug 13 '14 23:08

Blair Anderson


People also ask

What is SOAP node?

The SOAP nodes act as points in the flow where web service processing is configured and applied. Properties on the SOAP nodes control the processing carried out and can be configured by supplying a WSDL definition, or by manually configuring properties, or both.


1 Answers

In this example you should be looking at the key names and formats. For example any key with a [] at the end means this should be a SOAP Sequence. Without seeing the entire format of the input / output I can't be 100% certain on some - you could try using Node.js' util function to get a deep inspect of the object. For example:

var utils = require('utils');
/* later */
console.log( utils.inspect( testObject, {depth: null} ) );

To answer your question as much as I can:

var args = {
  ClientIDs: [{ /* Some object - not sure without inspect */ }],
  ObjectType: 'someString',
  Properties: ['someString', 'someString'],
  Filter: { /* Some object - not sure without inspect */ },
  RespondTo: [{ /* Some object - not sure without inspect */ }],
  PartnerProperties: [{ /* Some object - not sure without inspect */ }],
  ContinueRequest: 'someString',
  QueryAllAccounts: true, /* or false */
  RetrieveAllSinceLastBatch: true, /* or false */
  RepeatLastResult: true, /* or false */
  Retrieves: [{ /* Some object - not sure without inspect */ }],
  Options: [{ /* Some object - not sure without inspect */ }]
}

client.RetrieveRequest(args, function(err, result, raw, soapHeader) {
  /* do something with the result */
});
like image 128
Stuart Elmore Avatar answered Oct 24 '22 13:10

Stuart Elmore