C # Getting XML SOAP response from auto-generated Reference.cs in Visual Studio

In visual studio 2008 using .net 3.5, I used WSDL, which automatically created Reference.cs. This was done by right-clicking the β€œLinks” link in my project and selecting β€œAdd Web Link”

Using this, I can publish to the web service and receive valid responses through my ref and out objects. postValues ​​() is a void method.

webService.postValues(ref value1, ref value2, out value3); 

Using WireShark, I can see the request and the full response to the soap on my network.

What I'm trying to figure out is how I can capture this raw SOAP response in my code. I would like to fix this for logging purposes and would rather not individually serialize each of the ref objects.

I can't do it anyway without changing the automatically generated Reference.cs, which most likely does not. Any help would be greatly appreciated.

Edit: There seems to be no way to do this as I see. Can anyone confirm or deny this?

EDIT. I know this again to find out if anyone knows.

+4
source share
1 answer

You have the following options:

  • Enable tracing for your web service in the configuration and upload all the information to a file. If you use WCF instead of legacy web services, see this question in how to enable tracing for WCF .
  • Implement your own SoapExtension and connect to the message processing pipeline to intercept and discard incoming / outgoing soap messages. I think the example in related art contains TraceExtension, which does just that.
  • Modify the generated Reference.cs and dump objects as you specified.
+2
source

Source: https://habr.com/ru/post/1469301/


All Articles