Adobe Campaign JavaScript SDK

Dynamic Invocation of SOAP calls

Soap calls can be invoked dynamically as follows

const namespace = client.NLWS["xtkSession"];
const method = namespace["getOption"];
const result = await method.call(namespace, parameters);

where parameters is the list of parameters to the SOAP call.

Parameters can be a function which can compute and return the list of parameters as the function is being called:

const result = await method.call(namespace, (method, callContext) => {
  return parameters;
});

The method parameter is the XML definition of the SOAP method call. The callContext is an object which contains the following attributes:

In this blog post, you'll find an advanced example of how to use a dynamic SOAP invocation to implement a REST proxy to the ACC API using the SDK. The example shows how to pass query parameters or body to the SOAP call, and how to collect the names of the return value parameters to format the result as a proper JSON object.