I am trying to make an aspx talk to attain 3.10 using msmq. I am using Codeunit 6221 to recieve the XML messages. I have a process written in good ole asp scripts that work so the navision side of things is working. I can see the new messages being added to the message que. They look the same as the messages being produced by the asp. While the navision que handler automation server removes all the messages from the que only those from the asp get to Attain. The messages from the aspx are dropped. It must be some thing simple I am missing but I can not see what I am doing wrong. The code to send a message is Private Sub SendMsg(ByVal MsgXML) Dim msgq As New System.Messaging.MessageQueue(".\private$\jobmq", True) Dim msg As New System.Messaging.Message() msg.Label = “NCPXMLREQUEST” msg.Priority = 1 msg.Body = MsgXML msgq.Send(msg) End Sub Nothing much their to go wrong, MsgXML is an XML Document, and for now I am not bothering about the returned message. Has anybody got anything simular to work with .NET. Paul Baxter Edited by - triff on 2002 May 13 17:02:27
Hi Paul, the thing is to use a formatter (ActiveXFormatter). I have some code that works for me, in C# but I guess you’ll be able understand it: System.Messaging.MessageQueue mq = new MessageQueue(); mq.Path = “FormatName:Direct=OS:.\private$\jobmq”; mq.Formatter = new System.Messaging.ActiveXMessageFormatter(); mq.Send(sendString,“NCPXMLREQUEST”); I load the XML in a string called sendString, and send it to the queue (with a label NCPXMLREQUEST). I don’t use any priority here, but I’ll guess this works with a System.Messaging.Message as well…hopefully. Best Regards Dag
Thanks Dag That worked perfectly when you send the xml message as a text type. I ended up with Private Sub msgque(ByVal MsgXML) Dim msgq As New System.Messaging.MessageQueue() Dim msg As New System.Messaging.Message() Dim SendString As String SendString = MsgXML.OuterXml msgq.Path = “.\private$\jobmq” msg.Formatter = New System.Messaging.ActiveXMessageFormatter() msg.Label = “NCPXMLREQUEST” msg.Priority = 1 msg.Body = SendString msgq.Send(msg) End Sub for the next person who tries this. Why is the ActiveXMessageFormatter() so important as the messages on the queue look the same, although they don’t act the same.
If they really do look exactly the same, I don’t know…but I had a problem with the xml-messages looking like this (viewing messages in MMC): EXAMPLE did not work (not using the ActiveXFormatter), but this <.X.M.L.>.E.X.A.M.P.L.E.<./.X.M.L.>. worked, as it also looked in my original CommercePortal installation. And to get the XML to look like this, the ActiveXFormatter is the key. /Dag
Yes I know, the second example is unicode. I managed to encode the xml document and it still did not work. It does not matter as I can now get it to work, but I was just wondering why they work. Paul Baxter