Message Queue Send doesn't tell me the ID

will_in_wi
Member Posts: 6
I am trying to set up a web service so that I can communicate with navision via a Cold Fusion web site. I am using message queues. I used to simply send the message on one queue and then use receive to get the response message on another queue. I hit a snag when I tried doing several connections at the same time or the browser timed out. The service would receive the first message on the queue regardless of whether it was the message the service was supposed to get back. I then tried to use ReceiveByID so that I could make sure that the messages were being received by the service that was supposed to get them. I believe Navision will use the same ID for the response message as the message nav received. The problem comes in when I try to figure out the ID of the message I sent to navision. Is there a function that sends the message and returns the ID? Or am I going about this wrong? Here is my code in VB.Net:
Public Function SendMsg(ByVal Message As String) As String Dim mqFromNavision As Messaging.MessageQueue = New Messaging.MessageQueue("FromNavision") Dim mqToNavision As Messaging.MessageQueue = New Messaging.MessageQueue("ToNavision") Dim messageid As String // this will be the id of the sent message mqToNavision.Send(Message, "Navision MSMQ-BA") mqFromNavision.Formatter = New Messaging.XmlMessageFormatter(New Type() {GetType(String)}) Dim QueueMessage As Messaging.Message = mqFromNavision.ReceiveById(messageid, New System.TimeSpan(0, 0, 0, 30)) Return QueueMessage.Body End Function
0
Comments
-
I figured out that it is not the message ID but the correlation ID that navision needs to set for me to see which response is correct. I also figured out how to determine the id of the message that I sent. So now I need navision to, when it sends the response, set the correlation ID of the response message as the ID of the message that navision is responding to. I cannot figure out how to get navision to set the correlation ID.0
-
I have written several custom dll's to replace MS-Message Queue Bus Adapter.MSMQBusAdapter. I utilize a GUID on the message label. My custom dll, will respond with the same GUID, which allows me to peek for that GUID. This method also allows me to trap errors and respond with a message with that GUID.0
-
[Topic moved from Navision forum to Navision e-Commerce forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
You can also use the message queuing object model directly in Navision. The MQBA is very limited in its functionality.0
-
I have worked on a bunch of different solutions and came up with one that should work. I think I am just doing something really stupid because it doesn't. I am posting the code. I hope someone will look at it and figure out what I am doing wrong.
OBJECT Codeunit 70000 RunNavisionProcess { OBJECT-PROPERTIES { Date=01/16/06; Time=[ 9:47:52 PM]; Modified=Yes; Version List=MBS; } PROPERTIES { SingleInstance=Yes; OnRun=BEGIN IF ISCLEAR(ComCom) THEN IF NOT CREATE(ComCom) THEN ERROR(Text001); IF ISCLEAR(MSMQ_BA) THEN IF NOT CREATE(MSMQ_BA) THEN ERROR(Text001); ComCom.AddBusAdapter(MSMQ_BA,1); MSMQ_BA.OpenReceiveQueue('.\ToNavision',0,0); MSMQ_BA.OpenReplyQueue('.\FromNavision',0,0); END; } CODE { VAR ComCom@1450001 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{01018FA5-E4B4-413C-A47C-AD34B0CC2647}:'Navision Communication Component version 2'.CommunicationComponent" WITHEVENTS; MSMQ_BA@1450000 : Automation "{B8BD635A-E191-47EF-84A0-02921E2A44A6} 1.0:{CD49794B-0E84-4A2E-9522-C518C825D390}:'Navision MS-Message Queue Bus Adapter'.MSMQBusAdapter"; Text001@1450003 : TextConst 'ENU=Cannot create communication components.'; LOCAL PROCEDURE WriteToQueue@1240002(OutMsg@1450002 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{6CB9762C-E61C-4F96-BA34-8B20D3A5B46E}:'Navision Communication Component version 2'.OutMessage";XMLDoc@1450000 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 3.0:{F6D90F11-9C73-11D3-B32E-00C04F990BB4}:'Microsoft XML, v3.0'.DOMDocument"); VAR OutStreamQueue@1450001 : OutStream; BEGIN OutStreamQueue := OutMsg.GetStream(); XMLDoc.save(OutStreamQueue); OutMsg.Send(0); CLEAR(OutMsg); END; EVENT ComCom@1450001::MessageReceived@1(VAR InMessage@1450000 : Automation ":{00020400-0000-0000-C000-000000000046}:''.IDISPATCH"); VAR Company@1450012 : Record 2000000006; SalesHeader@1450010 : Record 36; InMsg@1450003 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{D184D0AC-61C9-4AC1-B537-0D28C277FEDE}:'Navision Communication Component version 2'.InMessage"; XMLDoc@1450006 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 3.0:{F6D90F11-9C73-11D3-B32E-00C04F990BB4}:'Microsoft XML, v3.0'.DOMDocument"; XMLNode@1450005 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 3.0:{2933BF80-7B36-11D2-B20E-00C04F983E60}:'Microsoft XML, v3.0'.IXMLDOMNode"; XMLDOMMgmt@1450001 : Codeunit 99008516; InStreamQueue@1450002 : InStream; XMLChar@1450007 : Text[1]; XMLText@1450004 : Text[1024]; UserName@1450014 : Text[1024]; CompanyName@1450013 : Text[1024]; FunctionName@1450008 : Text[1024]; ParameterList@1450009 : Text[1024]; DocumentType@1450011 : Option; Item@1102614000 : Record 27; ItemNo@1102614001 : Code[20]; BEGIN InMsg := InMessage; InStreamQueue := InMsg.GetStream(); REPEAT InStreamQueue.READTEXT(XMLChar); XMLText := XMLText + XMLChar; UNTIL InStreamQueue.EOS; CREATE(XMLDoc); XMLDoc.loadXML(XMLText); XMLNode := XMLDoc.selectSingleNode('string'); EVALUATE(ItemNo,COPYSTR(XMLNode.text,1,20)); IF Item.GET(ItemNo) THEN XMLNode.text := Item.Description ELSE XMLNode.text := 'Item not found'; //ERROR('x %1',XMLNode.text); WriteToQueue(InMsg.CreateReply,XMLDoc); InMsg.CommitMessage; CLEAR(InMsg); END; BEGIN END. } }
Thanks.0 -
I still don't get the problem, but if I put the line
MSMQ_BA.OpenWriteQueue('.\FromNavision',0,0);
with the other open queue statements it works, but still doesn't give me the correlation id0 -
Ok I have figured it out. To have createreply set the correlation id you have to set the message.responsequeue setting in the sending app.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions