On the MQReceiveComple ted 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><FIE LD1>CHIZL</FIELD1><FIELD2> DA
MAN</FIELD2></DATA>
---------
Methods
---------------------
public void SetupMSMQ()
{
String szMQPath = @".\private$\Te stQueue";
if (!MessageQueue. Exists(szMQPath ))
MessageQueue.Cr eate(szMQPath);
//setup MQ Request Path
MessageQueue mq = new MessageQueue(sz MQPath);
//format of message will be XML
mq.Formatter = new XmlMessageForma tter(new Type[] { typeof(String) });
//vs..
//((XmlMessageFor matter)mq.Forma tter).TargetTyp eNames = new string[] {
"Data" };
//setup async call
mq.ReceiveCompl eted += new
ReceiveComplete dEventHandler(M QReceiveComplet ed);
//callback ready
mq.BeginReceive ();
...
...
}
private static void MQReceiveComple ted(Object source,
ReceiveComplete dEventArgs asyncResult)
{
//connect to the queue.
MessageQueue mq = (MessageQueue)s ource;
//end the asynchronous Receive operation.
System.Messagin g.Message m = mq.EndReceive(a syncResult.Asyn cResult);
//display message information on the screen.
String szXML = (String)m.Body; //Fails
....
}
--
/*Chizl*/
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><FIE LD1>CHIZL</FIELD1><FIELD2> DA
MAN</FIELD2></DATA>
---------
Methods
---------------------
public void SetupMSMQ()
{
String szMQPath = @".\private$\Te stQueue";
if (!MessageQueue. Exists(szMQPath ))
MessageQueue.Cr eate(szMQPath);
//setup MQ Request Path
MessageQueue mq = new MessageQueue(sz MQPath);
//format of message will be XML
mq.Formatter = new XmlMessageForma tter(new Type[] { typeof(String) });
//vs..
//((XmlMessageFor matter)mq.Forma tter).TargetTyp eNames = new string[] {
"Data" };
//setup async call
mq.ReceiveCompl eted += new
ReceiveComplete dEventHandler(M QReceiveComplet ed);
//callback ready
mq.BeginReceive ();
...
...
}
private static void MQReceiveComple ted(Object source,
ReceiveComplete dEventArgs asyncResult)
{
//connect to the queue.
MessageQueue mq = (MessageQueue)s ource;
//end the asynchronous Receive operation.
System.Messagin g.Message m = mq.EndReceive(a syncResult.Asyn cResult);
//display message information on the screen.
String szXML = (String)m.Body; //Fails
....
}
--
/*Chizl*/
Comment