Weird XML exception when sending SOAP request
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开发者_JS百科(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
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.
精彩评论