发送 SOAP 请求时出现奇怪的 XML 异常

发布于 2024-10-21 02:51:20 字数 2491 浏览 2 评论 0原文

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

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

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

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

谢谢!

这是堆栈跟踪...

异常 System.Xml.XmlException:“.”(十六进制值 0x00)是无效字符。 1号线,位置79763。 在 System.Xml.XmlTextReaderImpl.Throw(异常 e) 在 System.Xml.XmlTextReaderImpl.Throw(String 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(XmlDocumentparentDoc) 在System.Xml.XmlLoader.Load(XmlDocument文档,XmlReader阅读器,布尔保留空白) 在 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, 手册 2.0

Have an application which publishes XML data across webservice using SOAP.

The data is pulled directly from an Oracle database and parsed into XML but for some reason the data being pulled out of the DB is throwing the following invalid XML exception.

Have done a bit of research and it looks like it may be a NULL character somewhere in the data which XML parser doesn't like.

Just wondering if anyone had seen this before and if so were they able to fix it at application or database layer?

Thanks!

Here's stack trace...

Exception System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character. Line 1, position 79763.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.Throw(Int32 pos, String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Int32 pos, Char invChar)
at System.Xml.XmlTextReaderImpl.ParseNumericCharRefInline(Int32 startPos, Boolean expand, BufferBuilder internalSubsetBuilder, Int32& charCount, EntityType& entityType)
at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
at System.Xml.XmlTextReaderImpl.ParseText()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlValidatingReaderImpl.Read()
at System.Xml.XmlValidatingReader.Read()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at Microsoft.Web.Services2.Security.MessageSignature.PreProcessElementInput(XmlElement elem)
at Microsoft.Web.Services2.Security.SignatureReference.CalculateHashValue(XmlDocument document, CanonicalXmlNodeList refList)
at Microsoft.Web.Services2.Security.MessageSignature.BuildDigestedReferences()
at Microsoft.Web.Services2.Security.MessageSignature.ComputeKeyedHashSignature(SymmetricKeyAlgorithm key)
at Microsoft.Web.Services2.Security.MessageSignature.ComputeSignature()
at Microsoft.Web.Services2.Security.Security.SerializeXml(SoapEnvelope document)
at Microsoft.Web.Services2.Security.SecurityOutputFilter.ProcessHeader(Security security, SoapEnvelope envelope)
at Microsoft.Web.Services2.Security.SecurityOutputFilter.ProcessMessage(SoapEnvelope envelope)
at Microsoft.Web.Services2.Pipeline.ProcessOutputMessage(SoapEnvelope envelope)
at Microsoft.Web.Services2.OutputStream.Close()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

UPDATE: Here is a selection of data being published.Just plain text basically, this is how it exists in database columns, have included as comma separated.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猛虎独行 2024-10-28 02:51:20

您从 Oracle 获取什么样的数据?博客?图像斑点?

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

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

What kind of data are you pulling from Oracle? A blog? Image blob?

The reason I ask is Images have headers, which means there will be a null char after the header. Not sure how to escape the null char, however, to make it valid for serialization, but you can possibly do something like base64 encode the image, which will mnean reversing the base64 conversion on the other end.

Outside of that, you should post the exact data you are pulling from Oracle, as that might help with a more specific answer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文