I would like to create a rest version of the following soap call to retreive a session token, is this possible?
Soap Call to
{{AdobeCampagin Server}}/nl/jsp/soaprouter.jsp
Body (where strLogin=User Id and strPassword=User Password
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xtk:session">
<soapenv:Header/>
<soapenv:Body>
<urn:Logon>
<urn:sessiontoken></urn:sessiontoken>
<urn:strLogin></urn:strLogin>
<urn:strPassword></urn:strPassword>
<urn:elemParameters>
</urn:elemParameters>
</urn:Logon>
</soapenv:Body>
</soapenv:Envelope>
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Ken_Qrious
You can use the below JS code to generate the sessionToken.
var cnx = new HttpSoapConnection("https://yourServerURL/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/>);//replace these details with actual userid and pass of mc account
var sessionToken = res[0];
var securityToken = res[2];
logInfo('sessionToken = '+ sessionToken)
logInfo('securityToken = '+ securityToken)
Regards
Akshay
Hi @Ken_Qrious ,
Here is a reference of a solved community question for the same query, Could you Please refer it and let me know if it helps.
Regards,
Pravallika.
Views
Replies
Total Likes
Hi @Ken_Qrious
You can use the below JS code to generate the sessionToken.
var cnx = new HttpSoapConnection("https://yourServerURL/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/>);//replace these details with actual userid and pass of mc account
var sessionToken = res[0];
var securityToken = res[2];
logInfo('sessionToken = '+ sessionToken)
logInfo('securityToken = '+ securityToken)
Regards
Akshay
Thanks Akshay, this worked like a charm. You instructions were clear and easy to follow.
Views
Replies
Total Likes
Hello @Ken_Qrious,
Hope you understand this won't work outside adobe campaign environment
Views
Replies
Total Likes
Yes, all good. I only need this for adobe campaign.
Hello @Ken_Qrious ,
there is no REST but you can make REST over SOAP
// as we are in JSSP you can also use page directives to import libraries
// <%@ page import="/nl/core/shared/nl.js"%>
<%
loadLibrary('/nl/core/shared/nl.js')
//with above we can use NL.reuire() instead loadLibrary()
NL.require('/nl/core/shared/xtk.js')
.require("xtk:shared/json2.js")
.require("xtk:common.js")
.require("/nl/core/api.js")
.require('/nl/core/jsspcontext.js')//for authentication
NL.API.init(request, response, {
jsonOutput: true
}, function(jsspContext) {
response.addHeader("Pragma", "no-cache")
response.addHeader("Cache-Control", "no-cache");
response.addHeader("Expires", new Date().toGMTString());
//do something resty
//ot call other SOAP libraries as needed
document.write(JSON.Stringify({result:"some result"}));
});
%>
Marcel Szimonisz
MarTech Consultant
for more tips visit my blog
https://www.martechnotes.com/
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies