title: SoapHttpClientProtocol log response xml
body: <p>For a couple of days we have problem with our app. We use SoapHttpClientProtocol in order to invoke java mbeans. This basically makes a call to a java webservice to invoke methods. </p>
  
  <p>Our problem is that sometimes we get the following exception:</p>
  
  <blockquote>
    <p>There is an error in XML document (1, 172089).    at
    System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
    xmlReader, String encodingStyle, XmlDeserializationEvents events)<br>
    at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
    xmlReader, String encodingStyle)    at
    System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
    message, WebResponse response, Stream responseStream, Boolean
    asyncCall)    at
    System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
    methodName, Object[] parameters)    at
    DynamicMBeanResourceBinding.Invoke(OperationRequestType
    ManagedResourceOperation) in JMXConnectorService.cs:line 781    at
    JMXWSClient.InvokeMethodOnObject(String objectName, String methodName,
    ParameterType[] paramValue) in connectivity\Client.cs:line 132</p>
    
    <p>Caused by: Unexpected end of file has occurred. The following elements
    are not closed: Icon</p>
  </blockquote>
  
  <p>Our last code in the communication layer is: </p>
  
  <pre><code> /// &lt;remarks/&gt;
  [System.Web.Services.Protocols.SoapHeaderAttribute("soapHeaders", Direction = SoapHeaderDirection.In)]
  [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://jsr262.dev.java.net/DynamicMBeanResource/Invoke", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
  [return: System.Xml.Serialization.XmlElementAttribute("ManagedResourceOperationResult", Namespace = "http://jsr262.dev.java.net/jmxconnector")]
  public GenericValueType Invoke([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://jsr262.dev.java.net/jmxconnector")] OperationRequestType ManagedResourceOperation)
  {
      object[] results = this.Invoke("Invoke", new object[] {ManagedResourceOperation});
      return ((GenericValueType)(results[0]));
  }
  </code></pre>
  
  <p>Is there any way of logging the response xml before is being deserialized by the framework? Any help or idea is very welcomed. </p>