473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Serializing a System.Exception using SOAP generates invalid XML

I try to serialize an exception using the SoapFormatter, but this is a little
bit problematic. The MethodInfo tag of the serialized exception contains &x00
characters (ASCII 0x00) in its serialized data. When the data is deserialized
on the client side the SoapHttpClientProtocol.ReadResponse uses an
XmlTextReader with Normalization switched on. In that case the &x00 character
is not valid and results in the following XmlException:

System.Xml.XmlException: '\0', hexadecimal value 0x00, is an invalid
character. Line 1, position 398.
at System.Xml.XmlScanner.ScanHexEntity()
at System.Xml.XmlTextReader.ParseBeginTagExpandCharEn tities()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlLoader.LoadChildren(XmlNode parent)
at System.Xml.XmlLoader.LoadElementNode()
at System.Xml.XmlLoader.LoadCurrentNode()
at System.Xml.XmlLoader.ReadCurrentNode(XmlDocument doc, XmlReader reader)
at System.Xml.XmlDocument.ReadNode(XmlReader reader)
at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadSoapException(XmlReader reader)
at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
methodName, Object[] parameters)

I don't know think that the actual problem is that the SOAP message parsing
uses a normalized reader, but the MethodInfo is serialized using '\0' as
seperators. I checked the serialization using the .NET Reflector tool and it
System.Exception is using this character on purpose. It is a bit weird that
the SoapFormatter can create serialized XML data that cannot be parsed on the
client side.

I can solve this problem by using a binary serialization and store the
BASE-64 data in the detail node, but this makes my SOAP messages less
readable. I really liked the idea to serialize exceptions via the Detail node
(I regenerate them on the client). I use a workaround right now, but I am not
quite happy with it. Can anyone comment to this issue?

--
Greetings,
Ramon de Klein
Nov 23 '05 #1
0 1856

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Lena | last post by:
I have generated a proxy class derived from System.Web.Services.Protocols.SoapHttpClientProtocol One of my classes is defined as public class MyClass { public MyClass() {
3
by: Don McNamara | last post by:
Hi, I've hit quite a strange problem with XmlSerializer on my W2K3 server. When I serialize/deserialize using an exe on my local computer (XP), everything works fine. When I put the code out on...
1
by: cjmumford | last post by:
I have a couple of C# objects like this: class Foo { } class Bar { Foo m_foo; Foo foo {
2
by: Tobias Zimmergren | last post by:
Hi, just wondering what serializing really is, and howto use it? Thanks. Tobias __________________________________________________________________ Tobias ICQ#: 55986339 Current ICQ status: +...
0
by: JackRazz | last post by:
I'm trying to serialize a collection to a file stream by serializing each object individually. The code below works fine with the BinaryFormatter, but the SoapFormatter reads the first object and...
1
by: Richard Atkinson | last post by:
I would appreciate help on the Microsoft Message Queue. Basically I would like to Serialize an entire class into a message queue and then reinstantiate the class in another application from the...
1
by: Marc | last post by:
Hi! I'm working with a C# client that calls a php web service. I've created a wrapper to call the service using .NET wsdl tool (adding a web reference). The call to the server works fine, it...
0
by: Ramon de Klein | last post by:
I try to serialize an exception using the SoapFormatter, but this is a little bit problematic. The MethodInfo tag of the serialized exception contains &x00 characters (ASCII 0x00) in its serialized...
1
by: bugnthecode | last post by:
Hi, I am trying to put together a small app that uses one of my company's web service. Originally I interfaced with this web service using java, and have the example code. I believe the web...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.