Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. MSMQ queuing vba process sends, C# process receive

MSMQ queuing vba process sends, C# process receive

Scheduled Pinned Locked Moved C#
helpcsharpdata-structuresquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rodrigorodriquez
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups