I'm using an ESB oriented solution to build integrations, and I'm experiencing lots of timed out callouts.

I'd like to track my Salesforce Callouts on the ESB to have an evidence on the ESB logs of which Salesforce Callouts are reaching the ESB and the ones which are not.

How could I modify my WSDL2Apex generated classes to include some SOAP header to track my requests?

  • ESB in turn is calling your external system. Now its the External system which is the root cause of timeout. I believe your ESB system should be smart enough to handle such timeouts. Set a timeout parameter in your ESB service within which you didnt get response, it should return error response with ESB acknowledgement ID that would mean ESB received the request but couldnt process it due to time constraints. Commented Oct 12, 2016 at 4:05
  • I'd like to have a smater and stronger ESB, but I haven't, meanwhile I could spent hours diving into the logs looking for a request that has never hit the ESB because another network stuff between the internet and the ESB, this is why I'd like to have a way to track my requests, something that I could log on Salesforce and then find on the ESB logs with a simple grep command Commented Oct 13, 2016 at 14:58

1 Answer 1


The wsdl2apex generated classes will include the inputHttpHeaders_x and outputHttpHeaders_x members.

You can use inputHttpHeaders_x to send additional HTTP headers in on the request and outputHttpHeaders_x to read any additional ones on the response.

See HTTP Header Support

Manually generating SOAP headers will be more involved. Typically these would be defined in the WSDL and would then be generated for you.

To do it manually you will need:

  • An Apex class to hold the header data. This will include the _type_info members to define any members plus the generic apex_schema_type_info and field_order_type_info string arrays.
  • A member on the Port class of the header data type
  • A string with the members name and the _hns suffix. The value of the string will set the namespace for that header.

The exact steps to do this will depend on the header you are trying to send.

  • 1
    Thank you @DanielBallinger, I will try the SOAP header's option... when I can Commented Oct 14, 2016 at 12:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .