MSMQ queuing vba process sends, C# process receive
-
I already posted this message but I can't see it anywhere. Hope this time will work. I need to receive a message from a message queue within MSMQ. I open the que ue with a VBA code and set the "body" of the msgqueue. From a C# i access th e queue and get the body but an exception occur: Data at the root level is invalid. Line 1, position 1. What can I do? Here follows the sw: vba _Sub write_a_message_() Dim strFormatName As String Dim qinfo As New MSMQQueueInfo Dim qDest As MSMQQueue Dim msg As New MSMQMessage strFormatName = ".\private$\test_per_coda_1" On Error GoTo ErrorHandler qinfo.PathName = strFormatName Set qDest = qinfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE) msg.Label = "Test Message" msg.Body = "mickey goofy and donald" msg.Send DestinationQueue:=qDest qDest.Close Exit Sub ErrorHandler: MsgBox "Error " + Hex(err.Number) + " was returned." _ + Chr(13) + err.Description end sub_this works correctly C# (where the problem occurs) Message msg; MessageQueue msgQ = new MessageQueue(@".\private$\test_per_coda_1"); msgQ.Formatter = new XmlMessageFormatter(new Type[] { typeof(string) }); msg = msgQ.Receive(); System.Console.WriteLine("massaggio ricevuto :: {0}", msg.Id); System.Console.WriteLine("massaggio ricevuto :: " + msg.Body.ToString()); the exception occurring at the very last instruction is :: Data at the root level is invalid. Line 1, position 1. Then I have used another VBA code that receive the message, I had no problem with manipulation of the "body". Many thanks in advance and best regards :confused::sigh:
rodrigo