473,473 Members | 1,549 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

MSMQ Formatter and XmlMessageFormatter

On the MQReceiveCompleted method below, I get an error "Name cannot begin
with the '.' character, hexadecimal value 0x00. Line 1, position 40."..
This data is XML that I'm putting into this queue.
---------
<?xml version=""1.0""
encoding=""utf-8""?><DATA><FIELD1>CHIZL</FIELD1><FIELD2>DA
MAN</FIELD2></DATA>
---------

Methods
---------------------
public void SetupMSMQ()
{
String szMQPath = @".\private$\TestQueue";

if (!MessageQueue.Exists(szMQPath))
MessageQueue.Create(szMQPath);

//setup MQ Request Path
MessageQueue mq = new MessageQueue(szMQPath);
//format of message will be XML

mq.Formatter = new XmlMessageFormatter(new Type[] { typeof(String) });
//vs..
//((XmlMessageFormatter)mq.Formatter).TargetTypeName s = new string[] {
"Data" };

//setup async call
mq.ReceiveCompleted += new
ReceiveCompletedEventHandler(MQReceiveCompleted);
//callback ready
mq.BeginReceive();

...
...
}
private static void MQReceiveCompleted(Object source,
ReceiveCompletedEventArgs asyncResult)
{
//connect to the queue.
MessageQueue mq = (MessageQueue)source;
//end the asynchronous Receive operation.
System.Messaging.Message m = mq.EndReceive(asyncResult.AsyncResult);
//display message information on the screen.
String szXML = (String)m.Body; //Fails
....
}

--
/*Chizl*/
Feb 28 '08 #1
2 12113
I vaguely recall having to use a BinaryFormatter when reading queue
items inserted by another language. You can try that and just get the
message body as a string.

Chizl wrote:
I think I know the problem, when I write it to the queue, I'm using VBS and
I noticed in the queue the data is in Unicode. So how do I get it to write
as ASCII?
Feb 28 '08 #2
For what it is worth I believe you mean the ActiveXFormatter, which should be
used when receiving messages sent by non .Net applications, for exmaple VB6
applications.

"Mufaka" wrote:
I vaguely recall having to use a BinaryFormatter when reading queue
items inserted by another language. You can try that and just get the
message body as a string.

Chizl wrote:
I think I know the problem, when I write it to the queue, I'm using VBS and
I noticed in the queue the data is in Unicode. So how do I get it to write
as ASCII?
Feb 29 '08 #3

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

Similar topics

1
by: CLEAR-RCIC | last post by:
I have a piece of code that works in C# but when I convert it to VB.Net I get the following error: "Cannot deserialize the message passed as an argument. Cannot recognize the serialization format."...
1
by: Lee Zeitz | last post by:
Hello, I have a need to read messages from MSMQ (on the order of 350,000 messages per day) that have a body that is text-only (not in XML format). There are 3 message formats to select from...
0
by: Stefan Näsman | last post by:
Hi When reading XML documents from a MSMQ Queue I get some serialization exception and I don't know how to solve it. Exception message: "Cannot deserialize the message passed as an argument. ...
0
by: Kimmo Laine | last post by:
Hi, how can i be sure that the MSMQ Message.Body property contains something valid? If i send the message like this: public void SendMyMessage( int msgCode, object msgData ) { Message msg =...
4
by: MSMQ workgroup and C# | last post by:
My MSMQ is in workgroup installation. I tried to add an event handler for the ReceiveCompleted event and to do It I try to use the SetPermissions. but I get an error of “A workgroup...
14
by: Webbee | last post by:
I have a service built that is trying to read messages from a private que. When this tries to happen I get this error.... A workgroup installation computer does not support the operation From...
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...
0
by: ASPnewb1 | last post by:
Hello, I have a question about MSMQ as I'm new to using this system in the .NET framework. Here is my following application that I run 2 instances of to test the ability to communicate...
0
by: thajudeen | last post by:
Hi , I am able to send a text file (.txt) to a message queue (MSMQ). But i am not able to receive the .txt file from the message queue. Please help how to proceed. I am Using BodyStream...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.