WCF - View xml request / response for a secure web service

I have a WCF service application, and in this application I make calls to a third-party web service through a secure connection.

I am trying to view the response flow of a request using a violinist, but I refused it, having tried for more than noon, using everything I could find over the Internet. This has a problem with certificates, although I made more fiddlers certificates in the trusted zone.

What is my best bet to just view the xml requests and responses that I make for this third-party web service?

I use the generated proxy classes, so I do not have access to the raw XML that I send and receive back. I am curious if I complicate too much what can be done much easier. This is my development machine, and I have access to everything, without any restrictions.

Easy way to do it please?

EDIT:

At this point, I don’t even need to use Tracing. I just need to see the serialized output of my request / response. Even if I can do this from a Visual Studio debugger or something, this will help.

+6
c # xml wcf
source share
3 answers

Since I was trying to read soap messages into the asmx web service referencing my WCF application, the solution to my problem was to create a class that inherits from System.Web.Services.Protocols.SoapExtension, register this class on the web. config so that all traffic is routed through this class and viewed.

None of these messages will be displayed on the WCF trace, so that is not enough. However, it was useful that I found out about this, so now I can see everything that happens between my wcf service and the web application.

This article nailed it for me how-to-capture-soap-envelopes-when-consuming-a-web-service

+4
source share

Use WCF trace - it works very well and comes with a convenient trace viewing utility .

You can configure many options - but at its core you will have to add something like this to your WCF services and client configurations:

<configuration> <system.diagnostics> <sources> <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true"> <listeners> <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData= "c:\log\Traces.svclog" /> </listeners> </source> </sources> </system.diagnostics> </configuration> 

There are many "trace listeners" - one writes to the output console in Visual Studio, XML files are created here, or you can store the material in the SQL Server database table - and the whole mechanism is extensible, you can also write your own trace listeners!

Also see here: Using WCF Tracing and here are Frequently Asked Questions about WCF Tracing for more information.

+7
source share

Add this to your app.config:

 <system.diagnostics> <sources> <source name="System.ServiceModel.MessageLogging"> <listeners> <add name="messages" type="System.Diagnostics.XmlWriterTraceListener" initializeData="messages.svclog" /> </listeners> </source> </sources> 

 <system.serviceModel> <diagnostics> <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="false" maxMessagesToLog="-1"/> </diagnostics> 

It will record all messages in messages.svclog. Then you can view them.

+2
source share

All Articles