SoapHttpClientProtocol log response xml
Asked Answered
H

1

9

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.

Our problem is that sometimes we get the following exception:

There is an error in XML document (1, 172089). at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
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

Caused by: Unexpected end of file has occurred. The following elements are not closed: Icon

Our last code in the communication layer is:

 /// <remarks/>
[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]));
}

Is there any way of logging the response xml before is being deserialized by the framework? Any help or idea is very welcomed.

Harrie answered 7/10, 2011 at 8:20 Comment(0)
H
3

The easiest way for doing this in a clean manner is to create a SOAP extension. I found a good tutorial here.

http://www.codeproject.com/KB/webservices/efficientsoapextension.aspx

Harrie answered 18/10, 2011 at 8:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.