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 ?

  • To do this programmatically you might be able to fish it out of the stack trace by newing up an Exception? – bigassforce Apr 25 '14 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. – Smruti Ranjan Tripathy Apr 25 '14 at 11:19
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.

  • 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. – bigassforce Apr 25 '14 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 .. – Smruti Ranjan Tripathy Apr 25 '14 at 11:17
  • I think it's simply not possible :( @SmrutiRanjanTripathy – bigassforce Apr 25 '14 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 – AtulRajguru9 Apr 25 '14 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. – Smruti Ranjan Tripathy Aug 12 '14 at 11:40

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.