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 docu开发者_如何学Cment (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 132Caused 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.
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
精彩评论