raj
raj

Reputation: 13

How to get WCF request in XML format?

I have created a WCF service and I am getting an appropriate output, but I want to know what request I am sending?

service1 oc = new service1();
oc.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None; 
oc.ClientCredentials.UserName.UserName = UserName;
oc.ClientCredentials.UserName.Password = Password; 
RM[] ass = oc.GetReasonMasterlist();

Upvotes: 0

Views: 73

Answers (1)

batwad
batwad

Reputation: 3655

You can write a custom interceptor if you want to do your own thing, or enable trace logging as per https://learn.microsoft.com/en-us/dotnet/framework/wcf/diagnostics/configuring-message-logging

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

<system.serviceModel>  
  <diagnostics>  
    <messageLogging   
         logEntireMessage="true"   
         logMalformedMessages="false"  
         logMessagesAtServiceLevel="true"   
         logMessagesAtTransportLevel="false"  
         maxMessagesToLog="3000"  
         maxSizeOfMessageToLog="2000"/>  
  </diagnostics>  
</system.serviceModel>  

Upvotes: 1

Related Questions