Adobe Campaign - SOAP API calls from a external webservice

priyankav251023

24-11-2016

Hi,

I wish to call SOAP API from an external webservice/ javascript. Need help on the step by step process. If anybody has tried this before than please help.

 

I tried the below sample code but do not get any result for session and security token

~~ var cnx = new HttpSoapConnection("https://[instance url]/nl/jsp/soaprouter.jsp");
var session = new SoapService(cnx, 'urn:xtk:session');
session.addMethod("Logon", "xtk:session#Logon",
                    ["sessiontoken", "string", "Login", "string", "Password", "string", "Parameters", "NLElement"],
                    ["sessionToken", "string", "sessionInfo", "NLElement", "securityToken", "string"]);

var res = session.Logon("", "username", "password", <param/>);
var sessionToken = res[0];
var securityToken = res[2];

cnx.addTokens(sessionToken, securityToken);
var query = new SoapService(cnx, 'urn:xtk:queryDef');
query.addMethod("ExecuteQuery", "xtk:queryDef#ExecuteQuery",
                    ["sessiontoken", "string", "entity", "NLElement"],
                    ["res", "NLElement"]);

Accepted Solutions (1)

Accepted Solutions (1)

florentlb

30-11-2016

Hi,

Have you replaced "username" and "password" by their actual values in:

var res = session.Logon("", "username", "password", <param/>);

Can you check that you get some activity on the server when doing this?

Thanks,

Florent