View SOAP XML from WCF Creating Client

I have created a WCF Client with the SVCUTIL.exe following these instructions : http://msdn.microsoft.com/en-us/library/ms733133.aspx

It creates a app.config and a soapproxy.cs file to use.

I can not figure out any way of getting the raw XML for debugging purposes.

Google has lots of examples with adding a traceextension to the web.config file, however I do not have a web.config file... And the examples I found are for web.service not System.ServiceModel;

I need to access the XML soap calls so I can debug it?

UPDATE: I am trying to edit the config trace to view the SOAP XML.

I have added this to the app.config file

<configuration>
    <system.diagnostics>
        <sources>
            <source name="System.ServiceModel" 
                    switchValue="Information, ActivityTracing"
                    propagateActivity="true">
                <listeners>
                    <add name="xml" />
                </listeners>
            </source>
            <source name="CardSpace">
                <listeners>
                    <add name="xml" />
                </listeners>
            </source>
            <source name="System.IO.Log">
                <listeners>
                    <add name="xml" />
                </listeners>
            </source>
            <source name="System.Runtime.Serialization">
                <listeners>
                    <add name="xml" />
                </listeners>
            </source>
            <source name="System.IdentityModel">
                <listeners>
                    <add name="xml" />
                </listeners>
            </source>
     </sources>

        <sharedListeners>
            <add name="xml"
                 type="System.Diagnostics.XmlWriterTraceListener"
                 initializeData="c:\log\Traces.svclog" />
       </sharedListeners>
    </system.diagnostics>
    </configuration>

However the trace log that comes up does not seem to include the raw XML

Answers


For quick debugging I use the WCF Test Client. Its quite simple and works with WCF and ASMX services. I also use it to consume services from third party applications written in Java (with wsdl definitions).

Start -> Visual Studio 2010 Command Prompt -> wcftestclient.exe

or

Start -> Visual Studio 2008 Command Prompt -> wcftestclient.exe

Information here: http://msdn.microsoft.com/en-us/library/bb552364.aspx

This has the ability to view the XML/SOAP request and response.

Also I use the XMLTraceListener. This generates the trace for me inside my application path and I am able to view the entire request/response body.

Here is my web.Config section

<system.diagnostics>
<sources>
  <source name="System.ServiceModel"
         switchValue="All">
    <listeners>
      <add name="xmlTraceListener" />
    </listeners>
  </source>
  <source name="System.ServiceModel.MessageLogging"
   switchValue="All">
    <listeners>
      <add name="xmlTraceListener" />
    </listeners>
  </source>
</sources>
<sharedListeners>
  <add name="xmlTraceListener"
   type="System.Diagnostics.XmlWriterTraceListener"
    initializeData="ApplicationTrace.svclog" />
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>

Need Your Help

query string gets ignored after mod_rewrite

php apache mod-rewrite query-string

I am using the following rewrite rule in my .htaccess file to send all requests to the index.php file located at the root:

Angular HTTP Post using CORS works behind the scene, but doesn't “succeed”

asp.net-mvc http angularjs cors

I'm working on an AngularJS project, and I need to perform a cross-domain (CORS) POST.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.