admin

ServiceNow Automation Templates: SOAP using their Demo 11

Discussion created by admin on Oct 17, 2013
Latest reply on Mar 2, 2017 by Mohamed_Ben_Hadj_Ali_6297
A series of customers have been asking for ServiceNow Automation, so I thought I would share the following ServiceNow templates. The attached templates are for communicating with ServiceNow's demo sandbox.  To use them, do the following: 1) Download the templates for REST and/or SOAP 2) Open the XML file and do a global find and replace from RA_WEBSERVICE_3 to whatever you have named your Web service agent host 3) Import the templates 4) SOAP Templates Only --- Open each connection object  for the Change, Problem and Incident Management services.  "Retrieve WSDL" to generate the SOAP adapter on your agent 14ed982fb1abc5c98f91f25fee5951.jpg 5) For both templates, if needed update the urls ServiceNow takes their demo boxes up and down and refreshes them every 24 hours. They load balance access to their sandbox from this link. Or you can go directly to a given box e.g.       https://demo001.service-now.com/       https://demo010.service-now.com/       https://demo011.service-now.com/ These sites are a bit of a moving target because they are open to anyone who wants to play with them.  If you need to change to another demo instance, just open up the connection object, change the uri, and you are good to go.  Or, you can request for a time bombed POC  environment from:      http://servicenow.com/demo The POC environment ensures a stable environment while you explore. Web Service APIs to automate ServiceNow: SOAP -  http://wiki.servicenow.com/index.php?title=SOAP_Web_Service JSON REST -  http://wiki.servicenow.com/index.php?title=JSON_Web_Service Getting started in your own environment Note: the attached templates work with the ServiceNow hosted demo environment so you don't need a ServiceNow instance to start playing with these templates now.  In a customer environment, the admin needs to activate the corresponding API plugin on the ServiceNow system.  You need to decide which direction you want to go, SOAP or REST. Personally I find the SOAP agent easier to use because of the WSDL. Since almost every ServiceNow environment is customized from the out of the box installation, there is a WSDL specific to that environment.  For example, some companies may or may not have an address field on a given form, this would change the WSDL generated for that environment. Also, some fields are mandatory for some environments and not for others. The following links teach you how to enable the API and get the corresponding SOAP WSDL. Troubleshooting SOAP If you get follow error, it is because their demo systems are constantly changing so they may have disabled rights for that user for automation or deactivated the SOAP plugin API.  Or the demo system does not have Problem Management setup.
+++++++++++++++++++++++++++++++++++++ Start of Runtime Exception ++++++++++++++++++++++++++++++++++++ org.apache.axis2.AxisFault: com.glide.processors.soap.SOAPProcessingException: Insufficient rights for creating new records      at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
If you get the following error, it is likely because you are passing a value that is considered null and it needs a proper value.  e.g. in the create problem job we are passing a parameter sys_id as &sys_id#.  If you don't set that value within the workflow, you will pass a null and the marshalling code will fail.
+++++++++++++++++++++++++++++++++++++ Start of Runtime Exception ++++++++++++++++++++++++++++++++++++ java.lang.ClassCastException: org.apache.axiom.soap.impl.llom.soap11.SOAP11BodyImpl cannot be cast to org.apache.axiom.soap.SOAPFault      at org.apache.axiom.soap.impl.builder.SOAP11BuilderHelper.handleEvent(SOAP11BuilderHelper.java:90)      at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:422)

Outcomes