3

I make an apex callout to an external service by consuming the WSDl file.I use WSDL2Apex class which I generated from WSDL file. I send a XML file as a request formed in my apex class to make a callout. When I check the debug log I see something like CALLOUT REQUEST which has some apex schema ....{Some way of shwoing the request}... Is there a way to see complete request.xml in debug log?

7
  • Have you tried setting the Callout settings to "Finest"? I'm not sure it'll help, but it's worth a shot.
    – sfdcfox
    Jan 3 '17 at 23:26
  • Are you making the Callout from a Developer Edition org or a Sandbox? If I recall correctly only Developer Edition orgs show the full callout SOAP request in the logs. Or at least that was the case historically. Jan 3 '17 at 23:41
  • @DanielBallinger I am using sandbox. I don't see the request.xml as I see in Soap UI
    – SfdcBat
    Jan 3 '17 at 23:42
  • @sfdcfox I have it set as finest. But did jot get the complete request xml that I am passing. Basically I am trying to see what values I am passing in the request. Whether the values are set correctly when sending request. I had to debug an incorrect request since the end system was not receiving any values.
    – SfdcBat
    Jan 3 '17 at 23:44
  • 1
    @SfdcBat It does in Developer Edition orgs. Again, in a Sandbox it might be significantly truncated to keep the log size down. Jan 4 '17 at 0:06
3

You can't see the full CALLOUT_REQUEST from a Sandbox. See the idea - View Callout Request and Response XML in Sandbox.

We can't do this without blowing up the debug logs. Debug logs can only be 2MB, and your request and/or response can be 12MB. Even if it's only 1MB each, that's the end of your debug log.

We have the same issue with String. If we wrote out the value of each string every time it was changed, the logs would be consumed by the string variables. For these, we truncate, so you can get an idea of the contents of the variable. A truncated request or response would be nothing but frustrating, as all you'd get would be the first part of the header.

If you know your request or response is small, and won't consume your entire debug log, you can output the body directly by calling something like system.debug(req.getBody()).

If you want to see it you will need to use a Developer Edition org.

It's a bit clunky, but you could use a secondary external service to receive and log the SOAP request. I've seen suggestions for requestb.in. I went so far as to to create an Apex REST resource that would save the POST body to a custom object. See Debugging an Outbound Message using a public facing Apex REST web service

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.