2

I am working a salesforce integration project. We are making n number of web service calls to third party services. Now I have to implement a logger , where I need to store the soap request and response in xml format. Most preferable is the same soap request and response xml.

How I can intercept this request and response , in apex problematically ?

Is it the only option left to xml serialize my request and response explicitly ?

2
  • To do this programmatically you might be able to fish it out of the stack trace by newing up an Exception? Commented Apr 25, 2014 at 10:37
  • @user320 Yes that might work , but as per my research till now , system debugs will not work in Sandboxes , it will only work Dev environment. Commented Apr 25, 2014 at 11:19

2 Answers 2

1

When you create a Proxy Class from WSDL to call web service it contain all the code.

If you want to debug log in function you can find that function in your proxy class (Generated from WSDL) and intercept all XML. If you want to do it for all request then you need to study the Proxy class and find best place for your interceptor.

5
  • 1
    +1. Nice. XML dumps of the request and response can only be obtained from the Debug Logs. Reaching into the service class will give you the object dumps but not XML. Commented Apr 25, 2014 at 10:37
  • yes , reaching out to the Service class , I can only have the object dumps , not xml . I already mentioned it in my question "is it the last option to xml serialize my request and response" ? I would like to know how I can get the XML of request and response. Thanks for answering .. Commented Apr 25, 2014 at 11:17
  • I think it's simply not possible :( @SmrutiRanjanTripathy Commented Apr 25, 2014 at 11:41
  • I do not agree with you @SmrutiRanjanTripathy. Here is why developer.salesforce.com/page/Apex_Web_Services_and_Callouts ..... Note the use of outputHttpHeaders_x Commented Apr 25, 2014 at 14:07
  • @AtulRajguru9 Thanx , I Infact followed a similar work around for this. I did intercepted in the proxy class and logged the toString() response (I have overridden the request and response stubs for as Json) of request and response objects into a custom sObject. Commented Aug 12, 2014 at 11:40
4

The Salesforce solution:

reference is here Inspect outbound SOAP XML requests

2
  • Thank you for expanding your answer and adding more details, upvoted. Welcome to SFSE!
    – identigral
    Commented Jun 3, 2022 at 16:15
  • beeceptor is a great tool; I've used it multiple times. Commented Apr 18, 2023 at 13:06

You must log in to answer this question.

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