tags:

views:

909

answers:

2

I am writing a simple xml string to an MSMQ from a VB6 app, but when I attempt to read the message off the queue in C# using the XmlMessageFormatter I get the following error:

"Name cannot begin with the '.' character"

How do I successfully read these messages using .Net code?

A: 

first inspect your data to make sure it really is as the error message implies. If it is, first read the data as text or binary, remove the offending '.', then use the xmlmessageformatter

Steven A. Lowe
+1  A: 

I believe that you have to use the ActiveXMessageFormatter, and not the XmlMessageFormatter. The XmlMessageFormatter is for sending objects between .net applications. What you are sending is not xml but string. And not a .net string. According to the documentation of the ActiveXMessageFormatter it is for:

Serializes or deserializes primitive data types and other objects to or from the body of a Message Queuing message, using a format that is compatible with the MSMQ ActiveX Component

When you send from vb6 you are using the msmq com interface. Which is another name for ActiveX interface. After you receive the string with the ActiveXMessageFormatter. Convert it to xml object explicitly.

Igal Serban