WCF Service client - get Client and Server soap xml as string for internal usage
I have a simple WCF service client in c# that I am using:
AccountsSoapClient a = new AccountsSoapClient();
TaskResult res = a.开发者_Go百科OpenAccount();
Is there any way to get the client submitted sop xml and the server response?
for example:
AccountsSoapClient webService = new AccountsSoapClient();
bool res = webService.OpenAccount();
String client = webService.getClientSubmittedXml();
String server = webService.getServerResponseXml();
thanks
If it is for logging purposes you could simply activate tracing. If not you could write a custom message inspector which will allow you to capture the request/response messages. And here's a blog post illustrating a custom inspector.
精彩评论