How to use setAuthentication method in Preview Script Usage link in SOAP Message Function?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2019 02:59 AM
When I click on the Preview Script Usage related link in insert SOAP Message Function, I am provided with the script as shown below.
I am trying to use the below commented code for SOAP message authentication.
r.setAuthentication(authentication type,profile name);
In my example scenario, I try to use :
s.setAuthentication('basic', '60545773db73330044247b8239961962'); //Sys ID of Basic Auth Configuration [sys_auth_profile_basic] record
However, I am unable to create any record in the target instance. I have checked the credentials and they are working correctly. I get an error in response body as User Not Authenticated.
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>User Not Authenticated</faultcode><faultstring>User Not Authenticated</faultstring><detail>Error completing SOAP request</detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
I also tried to search for this method in the ServiceNow API Reference at https://developer.servicenow.com/app.do#!/api_doc?v=newyork&id=sn_ws-namespace
But, this method seems to be present only in RESTMessageV2 API. How do we use this method for SOAPMessageV2 API as displayed in Preview Script Usage?
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2019 07:21 AM
They have a typo in their example. It should be: setAuthenticationProfile instead of setAuthentication.
s.setAuthenticationProfile('basic','60545773db73330044247b8239961962' )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2019 03:30 AM
I have tried that and it gives an error
com.glide.script.fencing.MethodNotAllowedException: Function setAuthenticationProfile is not allowed in scope global
I think this happens because the method is defined for RESTMessageV2 and not SOAP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2020 04:22 AM
Hello,
I'm facing with same issue.Anyone can help me?