Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View raw XML request

I am very new to WCF and SOAP messaging but I have managed to put together a reasonably good client which I am using to download news stories from a media organisation. I have generated proxy classes which obviously abstract a lot away and mean that I am basically just creating objects, calling methods and iterating through results.

My issue is that I have raw XML examples of what the calls to the web service should look like and I want to be able to "compare" these to the calls that I am making. Basically I need to ensure that the calls that I am making are the same as the example XML files for testing purposes.

Does what I am asking make sense or am I going about this the wrong way? Please let me know if there is any necessary information that I have left out, I could bang on for paragraphs but am not sure what information is relevant.

like image 835
dave Avatar asked Dec 15 '09 09:12

dave


People also ask

How do you check SOAP request and response?

Click the 'RAW' Tab in SOAP-UI Response Window to understand how the response is sent via HTTP. After processing the request, the http response code (200) is shown which means it is a success. The web-server has processed it successfully.

What is SOAP with example?

SOAP is the Simple Object Access Protocol, a messaging standard defined by the World Wide Web Consortium and its member editors. SOAP uses an XML data format to declare its request and response messages, relying on XML Schema and other technologies to enforce the structure of its payloads.


1 Answers

You can use WCF tracing to log the raw XML messages. The following is .config enables WCF tracing with raw message logging:

<configuration>
  <system.serviceModel>
    <diagnostics>
      <messageLogging maxMessagesToLog="30000"
              logEntireMessage="true"
              logMessagesAtServiceLevel="true"
              logMalformedMessages="true"
              logMessagesAtTransportLevel="true">
      </messageLogging>
    </diagnostics>
  </system.serviceModel>
  <system.diagnostics>
    <sources>
      <source name="System.IdentityModel" switchValue="Verbose" logKnownPii="true">
        <listeners>
          <add name="xml" />
        </listeners>
      </source>
      <!-- Log all messages in the 'Messages' tab of SvcTraceViewer. -->
      <source name="System.ServiceModel.MessageLogging">
        <listeners>
          <add name="xml" />
        </listeners>
      </source>
      <!-- ActivityTracing and propogateActivity are used to flesh out the 'Activities' tab in
           SvcTraceViewer to aid debugging. -->
      <source name="System.ServiceModel" switchValue="Error, ActivityTracing" propagateActivity="true">
        <listeners>
          <add name="xml" />
        </listeners>
      </source>
      <!-- This records Microsoft.IdentityModel generated traces, including exceptions thrown
           from the framework. -->
      <source name="Microsoft.IdentityModel" switchValue="Warning">
        <listeners>
          <add name="xml" />
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData="trace.e2e" />
    </sharedListeners>
    <trace autoflush="true" />
  </system.diagnostics>
</configuration>

You can read more about WCF Tracing from MSDN: Configuring Tracing.

Microsoft provides a Service Trace Viewer Tool to read .svclog files.

Make sure the path defined in initializeData is writable by your service.

like image 132
Daniel Vassallo Avatar answered Oct 05 '22 08:10

Daniel Vassallo