ServiceNow SOAP - Cheat Sheet Cheat Sheet
by Bibin Gokuldas (bibingokuldas) via cheatography.com/69673/cs/17691/
SOAP Vs Rest Basics SOAP Message API (cont)
setEccCorrelator(stri‐ Associate outbound requests and the re
ngcorrelator) ECC queue. Applicable to SOAP Messa
setEccParameter(na‐ Override a value from the database by w
me,value) payload
setEndpoint(endpoint) Set the endpoint for the SOAP message
setHttpTimeout(milise‐ Set the amount of time the SOAP messa
conds) the web service provider before the requ
setLogLevel(level) Sets the log level for this message and t
SOAP Structure The Values of level can be basic, elevat
SOAP It is the enclosing element of an XML message identifying it as a SOAP message.
setMIDServer(midse‐ Configure the SOAP message to be sen
Envelope
rvername)
SOAP A collection of one or more header blocks targeted at each SOAP receiver.
setMutualAuth(profile‐ Set the mutual authentication protocol p
Header
name)
SOAP Contains the body of the message intended for the SOAP receiver. The interpretation and
setRequestBody(req‐ Set the body content to send to the web
Body processing of SOAP body is defined by header blocks.
uestbody)
setRequestHeader(h‐ Set an HTTP header in the SOAP mess
Authentication Using SOAP
eadername,heade‐
Basic Basic Authentication can be enforced by setting a username and password for a webservice
rvalue)
Authen‐ request. When the property is enabled 'glide.basicauth.required' then auth header is mandatory
setSOAPAction(soap‐ Define the SOAP action this SOAP mes
tication
action)
setStringParameter‐ Set a variable with the specified name fr
SOAP Message API
(name,value) record to the specified value.
execute() Send the SOAP message to the endpoint.
setStringParameter‐ Set a variable with the specified name fr
executeAsync() Send the SOAP message to the ECC queue.
NoEscape(name,v‐ record to the specified value, doesn't es
getEndpoint() Get End point of specified SOAP message
alue)
getRequestBody() Get the content of the SOAP message body.
getRequestHeader(head‐ Get the value for an HTTP header specified by the SOAP client.
ername)
getRequestHeaders() Get HTTP headers that were set by the SOAP client and the associated
values.
setBasicAuth(username,pa‐ Set basic authentication headers for the SOAP message.
ssword)
By Bibin Gokuldas (bibingokuldas) Not published yet. Sponsored by CrosswordChe
cheatography.com/bibingokuldas/ Last updated 30th October, 2018. Learn to solve cryptic crosswor
bibingokuldas.com/ Page 1 of 2. http://crosswordcheats.com
ServiceNow SOAP - Cheat Sheet Cheat Sheet
by Bibin Gokuldas (bibingokuldas) via cheatography.com/69673/cs/17691/
SOAP Message API (cont) Direct Webservices (cont)
setWSSecurity(keystreID,keystrealias,keystrep‐ Sets web service security values for the SOAP delete‐ Deletes a record from the targeted table by supp
swd,certificate) message. Record sys_id.
deleteMul‐ Delete multiple records from the targeted table b
Are my Questions answered? tiple example values.
The standard SOAP API is a set of globally defined functions that
in ServiceNow, these functions cant be changed.
SOAP Concepts & Terminology
Provider : Publishes web service for clients to invoke (consume).
Direct Webservice API is defined by the format https://<instance n
Consumer : Invokes / consumes published web service.
om/<table name>.do
Standards : Standards are described below
WSDL : Web Service Description Language , XML document describing functions, arguments, data schema, and
SOAP Response APIs
endpoint (where / how to invoke the service, URL)
getAllHea‐ Return all headers contained in the respons
SOAP : Simple Object Access Protocol, XML document usually HTTP posted to web service endpoint described in
ders() headers.
WSDL SOAP:Envelope / SOAP:Header / SOAP:Body
getBody() Get the content of the SOAP response body
HTTP : Hyper-Text Transfer Protocol, POST vs GET - Web Service is POSTed
getCookies() Returns all cookies included in the response
Direct Webservices getErrorCode() Get the numeric error code if there was an e
Query the targeted table by example values and return a comma delimited sys_id list. Data ction.This is not Linked with the HTTP error
getKeys
Retrieval Get the error message if there was an error
getErrorMess‐
API
age()
getRecords Query the targeted table by example values and return all matching records and their Data Get the value for a specified HTTP header.I
getHeader‐
fields. Retrieval (name) then it will return the last of duplicate.
API
getStatus‐ Get the numeric HTTP status code returned
get Query a single record from the targeted table by sys_id and return the record and its Data Code()
fields. Retrieval Indicate if there was an error during the SO
haveError()
API
waitForRespo‐ Set the amount of time in seconds, the insta
aggregate Query using and aggregate functions SUM, COUNT MIN, MAX and AVG. To enable Data from the web service provider.
nse(seconds)
the aggregate functions, activate the Aggregate Web Service Plugin. Retrieval
The API which uses these function is SOAPResponseV2
API
var r = new sn_ws.SOAPMessageV2('SOAPMessage, 'function');
insert Creates a new record for the table targeted in the URL. Data
var resp = r.execute();
Modifi‐
var hdrs = resp.getAllHeaders();
cation API
for(var i in hdrs){
insertMul‐ Creates multiple new records for the table targeted in the URL. To enable multiple Data gs.log(hdrs[i].name + ': ' + hdrs[i].value);
tiple inserts, activate the Web Service Insert Multiple Plugin. Modifi‐ }
cation API
update Updates a existing record in the targeted table in the URL, identified by the mandatory Data
sys_id field. Modifi‐
cation API
By Bibin Gokuldas (bibingokuldas) Not published yet. Sponsored by CrosswordChe
cheatography.com/bibingokuldas/ Last updated 30th October, 2018. Learn to solve cryptic crosswor
bibingokuldas.com/ Page 2 of 2. http://crosswordcheats.com