Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web Service call results in an System.Xml.XmlException: '.', hexadecimal value 0x00

I get the following unhandled exception thrown from my web service - this isn't anything to do with my code and it only happens intermittently when calling the server asynchronously many times. I've included the code response object I get returned as well as this is the only thing that comes back (in this cause the generic response is a List of String). Has anyone come across this before of know why a web service might throw this?

Entire Stack Trace:

System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character. Line 4, position -88.
   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.XmlReader.ReadElementString()
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPartsLibraryService.Read29_GenericResponseOfListOfString(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPartsLibraryService.Read34_UploadPartsResponse()
   at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer5.Deserialize(XmlSerializationReader reader)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)

Simple Response object (pseudocode):

Public Class GenericResponse(Of T)
    Public Enum StateOptions

    Private _result As T
    Private _state As StateOptions
    Private _msg As String

    Public Property Result() As T
    Public Property State() As StateOptions
    Public Property Message() As String
End Class

I ran fiddler, but this was the only out of ordinary result I haven't seen, but I don't think it would cause the problem I'm experiencing?

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><UploadPartsResponse xmlns="http://autovhc.co.uk/"><UploadPartsResult><Result><string>--------------------------------------------------
01/06/2011 14:38:33
Upsert Exception
Backend sent unrecognized response type: &#x0;
   at Npgsql.NpgsqlState.&lt;ProcessBackendResponses_Ver_3&gt;d__a.MoveNext() in C:\projects\Npgsql2\src\Npgsql\NpgsqlState.cs:line 966
   at Npgsql.ForwardsOnlyDataReader.GetNextResponseObject() in C:\projects\Npgsql2\src\Npgsql\NpgsqlDataReader.cs:line 1163
   at Npgsql.ForwardsOnlyDataReader.GetNextRowDescription() in C:\projects\Npgsql2\src\Npgsql\NpgsqlDataReader.cs:line 1181
   at Npgsql.ForwardsOnlyDataReader.NextResult() in C:\projects\Npgsql2\src\Npgsql\NpgsqlDataReader.cs:line 1367
   at Npgsql.NpgsqlCommand.ExecuteNonQuery() in C:\projects\Npgsql2\src\Npgsql\NpgsqlCommand.cs:line 523
   at VHC.Connections.DataAccess2.DataAccess.sqlNonQuery(NpgsqlCommand sqlCmd, Boolean closeConnection) in E:\svn_repository\vhc.server.solution\vhc.connections\Tags\v_3_0_0_5\New\ConnectionProxys\DataAccess.vb:line 119
   at VHC.Connections.DataAccess2.DataAccess.sqlNonQuery(NpgsqlCommand sqlCmd) in E:\svn_repository\vhc.server.solution\vhc.connections\Tags\v_3_0_0_5\New\ConnectionProxys\DataAccess.vb:line 97
   at PartsLibServerSideClasses.DAO.PLM_PsaFormat_DAO.Update(PartLibraryPartTO part, Int32 entityref, NpgsqlConnection conn) in C:\Applications\PartsImporter\Import_Library-Stable\PartsLibServerSideClasses\DAO\PSA\PLM_PsaFormat_DAO.vb:line 61
   at PartsLibServerSideClasses.DAO.PLM_PsaFormat_DAO.Upsert(PartLibraryPartTO part, Int32 entityref) in C:\Applications\PartsImporter\Import_Library-Stable\PartsLibServerSideClasses\DAO\PSA\PLM_PsaFormat_DAO.vb:line 21
   at PartsLibServerSideClasses.Parsing.PartsLibraryManager.SubmitPartToLibrary(PartLibraryPartWorkSegmentContainer partContainer) in C:\Applications\PartsImporter\Import_Library-Stable\PartsLibServerSideClasses\BOL\PartsLibraryManager.vb:line 70
</string></Result><State>Fail</State></UploadPartsResult></UploadPartsResponse></soap:Body></soap:Envelope>
like image 695
Mr Shoubs Avatar asked May 31 '11 09:05

Mr Shoubs


People also ask

What does the hex value 0x00 mean?

'.', hexadecimal value 0x00, is an invalid character. Line 1, position 1. Then the program closes. Sorry, something went wrong. Which version? Anything odd happen last time it ran? Are you using Steam and doing any trade confirmations? Sorry, something went wrong.

What is 0x1F error in XML?

Error in XML document. Hexadecimal value 0x1F, is an invalid character I worked on an issue recently where we were noticing that a large majority of the out of the box System Center Configuration manager (SCCM) reports were throwing the same error. Very odd!

What is this error in XML document (1 21726)?

There is an error in XML document (1, 21726). '­', hexadecimal value 0x1F, is an invalid character. Line 1, position 21726. I opened up a few of the reports in Report Builder and saw that each had a few parameters that are in every SCCM report but each had one parameter which was common to just the failing reports.


1 Answers

I have seen this before in bug code that did not encode or remove 0 when users were copying/pasting values into a database field from another application and the zero was then coming out for those records all the way to the xml parser.

like image 107
MartyTPS Avatar answered Nov 15 '22 06:11

MartyTPS