SOAP Scripted webservice
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2016 06:32 AM
I have been trying to create the simple Scripted web service, to use it in Outbound SOAP.
let say for example, if I pass a nodename in request, the reponse should have the text 'Nodename is reachable'
but not able to achieve as I got the below error when try to test from the outbound soap.
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>com.glide.processors.soap.SOAPProcessingException: Insufficient rights to invoke script</faultstring>
<detail>com.glide.processors.soap.SOAPProcessingException: Insufficient rights to invoke script</detail>
</SOAP-ENV:Fault>
but if I use the example scripted webservice 'InstanceInfo' in outbound SOAP, able to test it successfully, got the response without any issues.
not sure what is missing, I assigned all Soap roles to my userid. is it something wrong with the scripted webservice?
can anyone please help me. possible please share the script for scripted webservice.
Thanks,
Chandran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2016 02:38 AM
yes both are servicenow instance
Inbound is scripted SOAP Service
Outbound SOAP message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2016 02:03 AM
Hi,
Make sure that the user account you are using in the application consuming the webservice is in ServiceNow and that user has has the SOAP roles and access to the tables you are accessing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2016 02:41 AM
Adding some more details
Yes both inbound and outbound is in servicenow
Inbound is scripted SOAP Service
Outbound SOAP message
user roles granted
Soap
Soap_create
Soap_delete
Soap_ecc
Soap_query
Soap_query_update
Soap_script
Soap_update
web_service_admin
inbound code snippets - copied from the sample scripted SOAP service "instanceinfo"
var resp = {'result':{}};
var mv = gs.getProperty('mid.buildstamp');
var mvo = gs.getProperty('mid.version.override');
if (mv == null)
mv = '';
if (mvo)
mv = mvo;
var legacyBuildstamp = null;
try {
legacyBuildstamp = MIDPackage.createLegacyBuildstamp(mv);
} catch (e) {
legacyBuildstamp = '';
}
resp.result.install_name = gs.getProperty( 'glide.installation.name', '' );
resp.result.instance_name = gs.getProperty( 'instance_name', 'unregistered' );
resp.result.instance_id = gs.getProperty( 'instance_id', 'unregistered' );
resp.result.build_date = gs.getProperty( 'glide.builddate', '' );
resp.result.build_tag = gs.getProperty( 'glide.buildtag', '' );
resp.result.system_id = ensure( gs.getSystemID() );
resp.result.node_id = ensure( gs.getNodeID() );
resp.result.instance_ip = ensure( gs.getInstanceIP() );
resp.result.mid_buildstamp = ensure(mv);
resp.result.mid_version = ensure(legacyBuildstamp); // deprecated at berlin release. use mid_buildstamp.
response.response = new XMLHelper().toXMLDoc(resp);
function ensure(datum) {
return (datum == null) ? '' : datum;
}
getting the below error while testing from outbound message
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>com.glide.processors.soap.SOAPProcessingException: Insufficient rights to invoke script</faultstring>
<detail>com.glide.processors.soap.SOAPProcessingException: Insufficient rights to invoke script</detail>
</SOAP-ENV:Fault>
But if i use the Sample scripted SOAP InstanceInfo in outbound message it is working properly.
even just the small scripted SOAP to return the hard coded value with the request string is fine for me.
like request is 'Node1' then response should be 'Node1 is reachable'
Please help me to achieve this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2016 02:58 AM
Does the user you are using in the SOAP service have access to MIDPackage.createLegacyBuildstamp?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2016 03:04 AM
And just to help you debug, instead of using: response.response = new XMLHelper().toXMLDoc(resp); try returning a simple string. If this functions I would use JSON. That gave me better results as you would be using object orientation.