gpt4 book ai didi

c# - SoapHttpClientProtocol 日志响应 xml

转载 作者:太空狗 更新时间:2023-10-29 19:44:28 49 4
gpt4 key购买 nike

这几天我们的应用程序出现了问题。我们使用 SoapHttpClientProtocol 来调用 java mbean。这基本上是调用 java webservice 来调用方法。

我们的问题是有时会出现以下异常:

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

我们最后在通信层的代码是:

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

有没有办法在框架反序列化之前记录响应 xml?非常欢迎任何帮助或想法。

最佳答案

以干净的方式执行此操作的最简单方法是创建 SOAP 扩展。我在这里找到了一个很好的教程。

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

关于c# - SoapHttpClientProtocol 日志响应 xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7684671/

49 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com