How to understand the node -soap function "describe"?

I am trying to use the node SOAP npm module ( https://github.com/vpulim/node-soap ).

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 figure out the exact format required for the parameters from the second console.log ...

Specifically, when I call client.Retrieve(options,function(e,r){});

, what should the format be options

?

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] } } }

      

Download:

 { 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' } } }

      

+3


source to share


1 answer


In this example, you should look at the names and formats of the keys. For example, any key with []

at the end means that it should be SOAP Sequence

. Without looking at the entire I / O format, I can't be 100% sure about some - you can try using Node.js' function util

to get a deep validation of the object. For example:

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

      



To answer your question as hard 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 */
});

      

+1


source







All Articles