c# - Intercept SOAP messages from and to a web service at the client -


i have client communicates web service. class communicate c# class generated through wsdl.exe. want log incoming , outgoing messages.

what i've done far write class inherits automatically generated c# class , have overridden getreaderformessage method. way can access incoming message more or less this:

protected override xmlreader getreaderformessage(soapclientmessage message, int buffersize) {     system.xml.xmlreader areader = base.getreaderformessage(message, buffersize);     system.xml.xmldocument doc = new system.xml.xmldocument();     doc.load(areader);     string content = doc.innerxml.tostring();     system.xml.xmlreader areader2 = system.xml.xmlreader.create(new system.io.stringreader(content));      return areader2; } 

obviously i'm not happy solution, because i'm creating 2 xml readers. 1 read contents of soap message , 1 return method caller. plus can't same getwriterformessage method.

but may i'm doing things difficult start with. instance possible read contents of soapclientmessage object directly? i've read articles suggesting should use soapextensions here, can understand, work if 'client' creating web service in case not.

any suggestions?

i suggest looking using soap extension, in opinion ideal scenario. here few links describe process.

http://msdn.microsoft.com/en-us/magazine/cc164007.aspx

https://ebay.custhelp.com/cgi-bin/ebay.cfg/php/enduser/std_adp.php?p_faqid=350

http://www.codeproject.com/kb/webservices/efficientsoapextension.aspx


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -