\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Bibin Gokuldas (bibingokuldas)} \pdfinfo{ /Title (servicenow-soap-cheat-sheet.pdf) /Creator (Cheatography) /Author (Bibin Gokuldas (bibingokuldas)) /Subject (ServiceNow SOAP - Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{BD0000} \definecolor{LightBackground}{HTML}{FCF7F7} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{ServiceNow SOAP - Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Bibin Gokuldas (bibingokuldas)} via \textcolor{DarkBackground}{\uline{cheatography.com/69673/cs/17691/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Bibin Gokuldas (bibingokuldas) \\ \uline{cheatography.com/bibingokuldas} \\ \uline{\seqsplit{bibingokuldas}.com/} \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 30th October, 2018.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{SOAP Vs Rest Basics}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{8.4cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/bibingokuldas_1540828774_SOAPVsREST.jpg}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2 cm} x{6 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{SOAP Structure}} \tn % Row 0 \SetRowColor{LightBackground} SOAP Envelope & \textasciicircum{}It is the enclosing element of an XML message identifying it as a SOAP message.\textasciicircum{} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} SOAP Header & \textasciicircum{}A collection of one or more header blocks targeted at each SOAP receiver.\textasciicircum{} \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} SOAP Body & \textasciicircum{}Contains the body of the message intended for the SOAP receiver. The interpretation and processing of SOAP body is defined by header blocks.\textasciicircum{} \tn % Row Count 11 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.64 cm} x{5.36 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Authentication Using SOAP}} \tn % Row 0 \SetRowColor{LightBackground} Basic \seqsplit{Authentication} & \textasciicircum{}Basic Authentication can be enforced by setting a username and password for a webservice request. When the property is enabled \seqsplit{'glide.basicauth.required'} then auth header is mandatory\textasciicircum{} \tn % Row Count 8 (+ 8) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{SOAP Message API}} \tn % Row 0 \SetRowColor{LightBackground} execute() & \textasciicircum{}Send the SOAP message to the endpoint.\textasciicircum{} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} executeAsync() & \textasciicircum{}Send the SOAP message to the ECC queue.\textasciicircum{} \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} getEndpoint() & \textasciicircum{}Get End point of specified SOAP message\textasciicircum{} \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} getRequestBody() & \textasciicircum{}Get the content of the SOAP message body.\textasciicircum{} \tn % Row Count 11 (+ 3) % Row 4 \SetRowColor{LightBackground} \seqsplit{getRequestHeader(headername)} & \textasciicircum{}Get the value for an HTTP header specified by the SOAP client.\textasciicircum{} \tn % Row Count 15 (+ 4) % Row 5 \SetRowColor{white} getRequestHeaders() & \textasciicircum{}Get HTTP headers that were set by the SOAP client and the associated values.\textasciicircum{} \tn % Row Count 19 (+ 4) % Row 6 \SetRowColor{LightBackground} \seqsplit{setBasicAuth(username},password) & \textasciicircum{}Set basic authentication headers for the SOAP message.\textasciicircum{} \tn % Row Count 22 (+ 3) % Row 7 \SetRowColor{white} \seqsplit{setEccCorrelator(stringcorrelator)} & \textasciicircum{}Associate outbound requests and the resulting response record in the ECC queue. Applicable to SOAP Messages through Mid Server\textasciicircum{} \tn % Row Count 29 (+ 7) % Row 8 \SetRowColor{LightBackground} \seqsplit{setEccParameter(name},value) & \textasciicircum{}Override a value from the database by writing to the SOAP message payload\textasciicircum{} \tn % Row Count 33 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{SOAP Message API (cont)}} \tn % Row 9 \SetRowColor{LightBackground} \seqsplit{setEndpoint(endpoint)} & \textasciicircum{}Set the endpoint for the SOAP message.\textasciicircum{} \tn % Row Count 2 (+ 2) % Row 10 \SetRowColor{white} \seqsplit{setHttpTimeout(miliseconds)} & \textasciicircum{}Set the amount of time the SOAP message waits for a response from the web service provider before the request times out.\textasciicircum{} \tn % Row Count 9 (+ 7) % Row 11 \SetRowColor{LightBackground} setLogLevel(level) & \textasciicircum{}Sets the log level for this message and the corresponding response. The Values of level can be basic, elevated, all\textasciicircum{} \tn % Row Count 15 (+ 6) % Row 12 \SetRowColor{white} \seqsplit{setMIDServer(midservername)} & \textasciicircum{}Configure the SOAP message to be sent through a MID Server.\textasciicircum{} \tn % Row Count 19 (+ 4) % Row 13 \SetRowColor{LightBackground} \seqsplit{setMutualAuth(profilename)} & \textasciicircum{}Set the mutual authentication protocol profile for the SOAP message.\textasciicircum{} \tn % Row Count 23 (+ 4) % Row 14 \SetRowColor{white} \seqsplit{setRequestBody(requestbody)} & \textasciicircum{}Set the body content to send to the web service provider.\textasciicircum{} \tn % Row Count 26 (+ 3) % Row 15 \SetRowColor{LightBackground} \seqsplit{setRequestHeader(headername},headervalue) & \textasciicircum{}Set an HTTP header in the SOAP message to the specified value.\textasciicircum{} \tn % Row Count 30 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{SOAP Message API (cont)}} \tn % Row 16 \SetRowColor{LightBackground} \seqsplit{setSOAPAction(soapaction)} & \textasciicircum{}Define the SOAP action this SOAP message performs.\textasciicircum{} \tn % Row Count 3 (+ 3) % Row 17 \SetRowColor{white} \seqsplit{setStringParameter(name},value) & \textasciicircum{}Set a variable with the specified name from the SOAP message record to the specified value.\textasciicircum{} \tn % Row Count 8 (+ 5) % Row 18 \SetRowColor{LightBackground} \seqsplit{setStringParameterNoEscape(name},value) & \textasciicircum{}Set a variable with the specified name from the SOAP message record to the specified value, doesn't escape XML reserved chars\textasciicircum{} \tn % Row Count 15 (+ 7) % Row 19 \SetRowColor{white} \seqsplit{setWSSecurity(keystreID},keystrealias,keystrepswd,certificate) & \textasciicircum{}Sets web service security values for the SOAP message.\textasciicircum{} \tn % Row Count 19 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Are my Questions answered?}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{SOAP Concepts \& Terminology}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\textasciicircum{} {\bf{Provider}} : Publishes web service for clients to invoke (consume).\textasciicircum{} \newline % Row Count 2 (+ 2) \textasciicircum{} {\bf{Consumer}} : Invokes / consumes published web service.\textasciicircum{} \newline % Row Count 4 (+ 2) \textasciicircum{} {\bf{Standards}} : Standards are described below\textasciicircum{} \newline % Row Count 5 (+ 1) \textasciicircum{}{\bf{WSDL}} : Web Service Description Language , XML document describing functions, arguments, data schema, and endpoint (where / how to invoke the service, URL)\textasciicircum{} \newline % Row Count 9 (+ 4) \textasciicircum{}{\bf{SOAP}} : Simple Object Access Protocol, XML document usually HTTP posted to web service endpoint described in WSDL SOAP:Envelope / SOAP:Header / SOAP:Body\textasciicircum{} \newline % Row Count 13 (+ 4) \textasciicircum{}{\bf{ HTTP : }}Hyper-Text Transfer Protocol, POST vs GET - Web Service is POSTed\textasciicircum{}% Row Count 15 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.368 cm} x{3.952 cm} x{2.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Direct Webservices}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{getKeys} & \textasciicircum{}Query the targeted table by example values and return a comma delimited sys\_id list.\textasciicircum{} & \textasciicircum{}Data Retrieval API\textasciicircum{} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \seqsplit{getRecords} & \textasciicircum{}Query the targeted table by example values and return all matching records and their fields.\textasciicircum{} & \textasciicircum{}Data Retrieval API\textasciicircum{} \tn % Row Count 10 (+ 5) % Row 2 \SetRowColor{LightBackground} get & \textasciicircum{}Query a single record from the targeted table by sys\_id and return the record and its fields.\textasciicircum{} & \textasciicircum{}Data Retrieval API\textasciicircum{} \tn % Row Count 15 (+ 5) % Row 3 \SetRowColor{white} \seqsplit{aggregate} & \textasciicircum{}Query using and aggregate functions SUM, COUNT MIN, MAX and AVG. To enable the aggregate functions, activate the Aggregate Web Service Plugin.\textasciicircum{} & \textasciicircum{}Data Retrieval API\textasciicircum{} \tn % Row Count 23 (+ 8) % Row 4 \SetRowColor{LightBackground} insert & \textasciicircum{}Creates a new record for the table targeted in the URL.\textasciicircum{} & \textasciicircum{}Data \seqsplit{Modification} API\textasciicircum{} \tn % Row Count 26 (+ 3) % Row 5 \SetRowColor{white} \seqsplit{insertMultiple} & \textasciicircum{}Creates multiple new records for the table targeted in the URL. To enable multiple inserts, activate the Web Service Insert Multiple Plugin.\textasciicircum{} & \textasciicircum{}Data \seqsplit{Modification} API\textasciicircum{} \tn % Row Count 34 (+ 8) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{1.368 cm} x{3.952 cm} x{2.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Direct Webservices (cont)}} \tn % Row 6 \SetRowColor{LightBackground} update & \textasciicircum{}Updates a existing record in the targeted table in the URL, identified by the mandatory sys\_id field.\textasciicircum{} & \textasciicircum{}Data \seqsplit{Modification} API\textasciicircum{} \tn % Row Count 6 (+ 6) % Row 7 \SetRowColor{white} \seqsplit{deleteRecord} & \textasciicircum{}Deletes a record from the targeted table by supplying its sys\_id.\textasciicircum{} & \textasciicircum{}Data \seqsplit{Modification} API\textasciicircum{} \tn % Row Count 10 (+ 4) % Row 8 \SetRowColor{LightBackground} \seqsplit{deleteMultiple} & \textasciicircum{}Delete multiple records from the targeted table by example values.\textasciicircum{} & \textasciicircum{}Data \seqsplit{Modification} API\textasciicircum{} \tn % Row Count 14 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{\textasciicircum{}The standard SOAP API is a set of globally defined functions that can be performed on a table in ServiceNow, these functions cant be changed.\textasciicircum{} \newline \newline \textasciicircum{}Direct Webservice API is defined by the format https://\textless{}instance name\textgreater{}.service-now.com/\textless{}table name\textgreater{}.do \textasciicircum{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{SOAP Response APIs}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{getAllHeaders()} & \textasciicircum{}Return all headers contained in the response, including any duplicate headers.\textasciicircum{} \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} getBody() & \textasciicircum{}Get the content of the SOAP response body.\textasciicircum{} \tn % Row Count 6 (+ 2) % Row 2 \SetRowColor{LightBackground} getCookies() & \textasciicircum{}Returns all cookies included in the response.\textasciicircum{} \tn % Row Count 8 (+ 2) % Row 3 \SetRowColor{white} getErrorCode() & \textasciicircum{}Get the numeric error code if there was an error during the SOAP transaction.This is not Linked with the HTTP error code.\textasciicircum{} \tn % Row Count 14 (+ 6) % Row 4 \SetRowColor{LightBackground} \seqsplit{getErrorMessage()} & \textasciicircum{}Get the error message if there was an error during the SOAP transaction.\textasciicircum{} \tn % Row Count 18 (+ 4) % Row 5 \SetRowColor{white} \seqsplit{getHeader(name)} & \textasciicircum{}Get the value for a specified HTTP header.If there are duplicate headers, then it will return the last of duplicate.\textasciicircum{} \tn % Row Count 23 (+ 5) % Row 6 \SetRowColor{LightBackground} \seqsplit{getStatusCode()} & \textasciicircum{}Get the numeric HTTP status code returned by the SOAP provider.\textasciicircum{} \tn % Row Count 26 (+ 3) % Row 7 \SetRowColor{white} haveError() & \textasciicircum{}Indicate if there was an error during the SOAP transaction.\textasciicircum{} \tn % Row Count 29 (+ 3) % Row 8 \SetRowColor{LightBackground} \seqsplit{waitForResponse(seconds)} & \textasciicircum{}Set the amount of time in seconds, the instance waits for a response from the web service provider.\textasciicircum{} \tn % Row Count 34 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\textasciicircum{}The API which uses these function is SOAPResponseV2 for ex :\textasciicircum{} \newline \textasciicircum{}var r = new \seqsplit{sn\_ws.SOAPMessageV2('SOAPMessage}, 'function');\textasciicircum{} \newline \textasciicircum{}var resp = r.execute();\textasciicircum{} \newline \textasciicircum{}var hdrs = resp.getAllHeaders();\textasciicircum{} \newline \textasciicircum{}for(var i in hdrs)\{\textasciicircum{} \newline \textasciicircum{}gs.log(hdrs{[}i{]}.name + ': ' + hdrs{[}i{]}.value);\textasciicircum{} \newline \textasciicircum{}\}\textasciicircum{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}