- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2018 08:00 AM
Hello,
I was able to set up Mutual Authentication using SSL for a third party Web Application. Testing REST Calls are working fine. But when I code a script include function to do the same - I am running into issues. I am testing the script includes using Automation Test Framework.
The code in Script Include looks like this
function JustReturnME(x){
var restMessage = new sn_ws.RESTMessageV2();
restMessage.setHttpMethod("post");
restMessage.setMutualAuth("myhttps"); // Setting the Mutual Auth Protocol (Same as used in testing the simple REST Calls)
restMessage.setEndpoint("##---MY REST URL---");
gs.print("MY DATA "+JSON.stringify(x));
restMessage.setRequestBody(JSON.stringify(x));
var response = restMessage.execute();
gs.print("THIS IS THE RESPONSE "+JSON.stringify(response));
return 'ok';
}
The code in the Automation Test Framework looks like this
(function(outputs, steps, stepResult, assertEqual) {
// add test script here
var input = {"description": "create to test servicenow","name": "EARTH"};
var result = JustReturnME(input);
if(result == 'ok'){
return true;
}else{
return false;
}
})(outputs, steps, stepResult, assertEqual);
The error I see when I invoke the test
14:41:06.525: Exception while registering protocol: myhttps Error: Password must not be null: no thrown error
The same "myhttps" Protocol profile is working just fine in the Test REST Call Screen and not from the script include.
Could someone please help me with the setup?
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2018 08:06 AM
Dear Ankur,
Thanks for the response. I had 2 global parameters set for glide.httpclient.protocol.myhttps.class and glide.httpclient.protocol.myhttps.port - That were conflicting with the Rest Call Invocation -
I have deleted those global parameters as they are not used any longer. And that has addressed the issue.
Regards,
Manohar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2018 10:32 PM
Hi Manohar,
As the message says the password seems to be empty for this testing. The reason it would be working from the other screen since the user must be already logged in I think so.
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2018 08:06 AM
Dear Ankur,
Thanks for the response. I had 2 global parameters set for glide.httpclient.protocol.myhttps.class and glide.httpclient.protocol.myhttps.port - That were conflicting with the Rest Call Invocation -
I have deleted those global parameters as they are not used any longer. And that has addressed the issue.
Regards,
Manohar