Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to print log the from SOAP response (Workday Integration)

ramesh_r
Mega Sage

Hi All,

We are using workday integration using SOAP web services i want to check what are all the value are coming in the response of the SOAP web services.

So please guide me where i have to put the log for printing the response values

 

Thanks

Ramesh R

2 REPLIES 2

Prasun
Giga Guru

Hi Ramesh,

 

I hope you are using a script include/BR to run the SOAP message. If not, you can use background script to call the soap web service. Below links contain the documentation.

https://docs.servicenow.com/bundle/london-application-development/page/integrate/outbound-soap/reference/r_ScriptingOutboundSOAP.html

https://docs.servicenow.com/bundle/london-application-development/page/app-store/dev_portal/API_reference/SOAPMessageV2/reference/r_DirectSOAPMessageV2Example.html

 

Sample Script:

 

var requestBody;
var responseBody;
var status;
var sm;
try{
	sm = new sn_ws.SOAPMessageV2("Sample Workday", "methodname");  // Might throw exception if message doesn't exist or not visible due to scope
	sm.setBasicAuth("admin","admin");
	sm.setStringParameter("symbol", "NOW");
	sm.setStringParameterNoEscape("xml_data","<data>test</data>");
	sm.setHttpTimeout(10000) //In Milli seconds. Wait at most 10 seconds for response from http request.

	response = sm.execute();//Might throw exception if http connection timed out or some issue with sending request itself because 	of encryption/decryption of password and stuff
	responseBody = response.haveError() ? response.getErrorMessage() : response.getBody();
	status = response.getStatusCode();
} catch(ex) {
	responseBody = ex.getMessage();
	status = '500';
} finally {
	requestBody = sm ? sm.getRequestBody():null;
}
gs.print("Request Body: " + requestBody);
gs.print("Response: " + responseBody);
gs.print("HTTP Status: " + status);

Hope this helps

Regards
Prasun

 

P.S. Mark Helpful or correct if Helps

Hi Prasun,

 

Thanks for response i am new to this , and i am not able to find from where they are executing the script .

 

I saw they Just ruining the exciting one scheduled job,

 

find_real_file.png

 

 

find_real_file.png

Here How to check the log..?

 

Thanks

Ramesh R