How to log request body in SOAP outbound message?

K Sankalp
Tera Contributor

Hello,

I am trying to log request body in SOAP message for troubleshooting.

However the request body get truncated in HTTP logs, its not useful. Also all parameters are set using setStringParameter() method.
Is it possible to get request body or log somewhere?

1 REPLY 1

AnkaRaoB
Tera Expert

Hi @K Sankalp 

  • HTTP logs intentionally truncate payloads
  • This applies especially to SOAP envelopes
  • setStringParameter() values are resolved at runtime, so the full XML isn’t reliably visible in HTTP logs
  • This is by design for performance and security

So HTTP logs are not the right place for SOAP troubleshooting.

Recommended Ways to Get the FULL SOAP Request Body

Option 1 (BEST): Use the SOAP Message Record (OOB)

This is the official and safest method.

Steps:

  1. Go to System Web Services → Outbound → SOAP Message
  2. Open your SOAP Message
  3. Run the request (or view execution)
  4. Click Related Links → Show SOAP Request
  5. Click Show SOAP Response

 Shows full request & response
 No truncation
 Works with setStringParameter()

Option 2: Log Request Body via Script (SOAPMessageV2)

If you are calling SOAP via script, you can log the entire request body like this:

var sm = new sn_ws.SOAPMessageV2('Your_SOAP_Message', 'Your_Action');

 

// set parameters

sm.setStringParameter('param1', 'value1');

sm.setStringParameter('param2', 'value2');

 

// BEFORE execute()

gs.info('SOAP Request Body:\n' + sm.getRequestBody());

 

// execute

var response = sm.execute();

 

Please Notes:

  • getRequestBody() returns the fully rendered SOAP XML
  • Log size limits still apply, but it’s much larger than HTTP logs
  • Use System Logs → All to view it

 

 

If this response helps you solve the issue, please mark it as the Accepted Solution