【问题标题】:Weird XML exception when sending SOAP request发送 SOAP 请求时出现奇怪的 XML 异常
【发布时间】:2011-03-09 03:47:10
【问题描述】:

拥有一个使用 SOAP 跨 Web 服务发布 XML 数据的应用程序。

数据直接从 Oracle 数据库中提取并解析为 XML,但由于某种原因,从数据库中提取的数据会引发以下无效 XML 异常。

做了一些研究,看起来它可能是 XML 解析器不喜欢的数据中某处的 NULL 字符。

只是想知道是否有人以前见过这个问题,如果有,他们是否能够在应用程序或数据库层修复它?

谢谢!

这是堆栈跟踪...

Exception System.Xml.XmlException: '.',十六进制值 0x00,是无效字符。第 1 行,位置 79763。 在 System.Xml.XmlTextReaderImpl.Throw(异常 e) 在 System.Xml.XmlTextReaderImpl.Throw(字符串 res,String[] args) 在 System.Xml.XmlTextReaderImpl.Throw(Int32 pos,String res,String[] args) 在 System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Int32 pos,Char invChar) 在 System.Xml.XmlTextReaderImpl.ParseNumericCharRefInline(Int32 startPos,布尔扩展,BufferBuilder internalSubsetBuilder,Int32& charCount,EntityType& entityType) 在 System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos,Int32& endPos,Int32& outOrChars) 在 System.Xml.XmlTextReaderImpl.ParseText() 在 System.Xml.XmlTextReaderImpl.ParseElementContent() 在 System.Xml.XmlTextReaderImpl.Read() 在 System.Xml.XmlTextReader.Read() 在 System.Xml.XmlValidatingReaderImpl.Read() 在 System.Xml.XmlValidatingReader.Read() 在 System.Xml.XmlLoader.LoadNode(布尔 skipOverWhitespace) 在 System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) 在 System.Xml.XmlLoader.Load(XmlDocument 文档,XmlReader 阅读器,布尔值 preserveWhitespace) 在 System.Xml.XmlDocument.Load(XmlReader 阅读器) 在 Microsoft.Web.Services2.Security.MessageSignature.PreProcessElementInput(XmlElement elem) 在 Microsoft.Web.Services2.Security.SignatureReference.CalculateHashValue(XmlDocument 文档,CanonicalXmlNodeList refList) 在 Microsoft.Web.Services2.Security.MessageSignature.BuildDigestedReferences() 在 Microsoft.Web.Services2.Security.MessageSignature.ComputeKeyedHashSignature(SymmetricKeyAlgorithm 键) 在 Microsoft.Web.Services2.Security.MessageSignature.ComputeSignature() 在 Microsoft.Web.Services2.Security.Security.SerializeXml(SoapEnvelope 文档) 在 Microsoft.Web.Services2.Security.SecurityOutputFilter.ProcessHeader(安全安全,SoapEnvelope 信封) 在 Microsoft.Web.Services2.Security.SecurityOutputFilter.ProcessMessage(SoapEnvelope 信封) 在 Microsoft.Web.Services2.Pipeline.ProcessOutputMessage(SoapEnvelope 信封) 在 Microsoft.Web.Services2.OutputStream.Close() 在 System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] 参数)

更新:这里是一些正在发布的数据。基本上只是纯文本,这就是它在数据库列中的存在方式,以逗号分隔。

614494, 2003, 33, 327, 15961, 59652, 2, 2, 3, 2, 1, 10-Dec-08, MY2003 AERO SEDAN, Manual 2.0

【问题讨论】:

  • 这只是您从数据库中获取然后通过 Web 服务返回的原始 XML 吗?如果是这样,您是否尝试过从数据库输出创建 XmlDocument,然后返回解析结果(或通过 XmlReader/XmlWriter)?

标签: asp.net oracle soap webservices-client


【解决方案1】:

您从 Oracle 提取了哪些类型的数据?一个博客?图像斑点?

我问的原因是图像有标题,这意味着标题后面会有一个空字符。但是,不确定如何转义空字符以使其对序列化有效,但您可以执行类似 base64 编码图像之类的操作,这将在另一端反转 base64 转换。

除此之外,您应该发布从 Oracle 提取的确切数据,因为这可能有助于获得更具体的答案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多