Problem with receiving Message Queue with ComCom

meehi
Member Posts: 16
Hi guys!
Here is the thing: I can't read the incomming message from Message Queue into any variable. The message is beeing sent by a C# application through Message Queue. This is the code in navision:
I think the problem is not with the XMLDom, because I tryed to replace the problematic line with this:
WHILE NOT (InS.EOS) DO
InS.READ(InText);
but when it tries to execute these two line Navision Application Server crashes.
After I removed the problematic lines everything runs fine.
And here is the code in C#:
Any help would might come in handy!
Thanks.
I followed the steps described here: http://msdn.microsoft.com/en-us/library/ms952182.aspx
Here is the thing: I can't read the incomming message from Message Queue into any variable. The message is beeing sent by a C# application through Message Queue. This is the code in navision:
OBJECT Codeunit 55089 N2 Handler { OBJECT-PROPERTIES { Date=10.10.28; Time=[ 8:50:45]; Modified=Yes; Version List=VD 1.0 sm; } PROPERTIES { SingleInstance=Yes; OnRun=BEGIN CREATE(MQBus); CREATE(CC2); CREATE(XMLDom); CC2.AddBusAdapter(MQBus,1); MQBus.OpenReceiveQueue('.\toNavision',0,0); END; } CODE { VAR MQBus@1000000000 : Automation "{B8BD635A-E191-47EF-84A0-02921E2A44A6} 1.0:{CD49794B-0E84-4A2E-9522-C518C825D390}:'Navision MS-Message Queue Bus Adapter'.MSMQBusAdapter"; CC2@1000000001 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{01018FA5-E4B4-413C-A47C-AD34B0CC2647}:'Navision Communication Component version 2'.CommunicationComponent" WITHEVENTS; XMLDom@1000000002 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 3.0:{F6D90F11-9C73-11D3-B32E-00C04F990BB4}:'Microsoft XML, v3.0'.DOMDocument"; XMLNode@1000000005 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 3.0:{2933BF80-7B36-11D2-B20E-00C04F983E60}:'Microsoft XML, v3.0'.IXMLDOMNode"; InMsg@1000000003 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{D184D0AC-61C9-4AC1-B537-0D28C277FEDE}:'Navision Communication Component version 2'.InMessage"; InS@1000000004 : InStream; OutMsg@1000000006 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{6CB9762C-E61C-4F96-BA34-8B20D3A5B46E}:'Navision Communication Component version 2'.OutMessage"; OutS@1000000007 : OutStream; EVENT CC2@1000000001::MessageReceived@1(VAR InMessage@1000000000 : Automation ":{00020400-0000-0000-C000-000000000046}:''.IDISPATCH"); VAR recTMPTable_L@1000000001 : Record 50006; codID_L@1000000002 : Code[10]; BEGIN // get the message InMsg := InMessage; InS := InMsg.GetStream(); // load the message into an XML document and find a node XMLDom.load(InS); //<-------------------------------------------NAS crashes exactly here XMLNode := XMLDom.selectSingleNode('string'); // open the response queue and create a new message MQBus.OpenWriteQueue('.\fromNavision',0,0); OutMsg := CC2.CreateoutMessage('Message queue://.\fromNavision'); OutS := OutMsg.GetStream(); // build the contents of your message //XMLNode.text := UPPERCASE(XMLNode.text); //TEMP REMOVE // fill the message and send it //OutS.WRITE(XMLDom.xml); //TEMP REMOVE OutS.WRITE('HELLO WORLD'); OutMsg.Send(0); END; EVENT XMLDom@1000000002::ondataavailable@198(); BEGIN END; EVENT XMLDom@1000000002::onreadystatechange@-609(); BEGIN END; BEGIN END. } }
I think the problem is not with the XMLDom, because I tryed to replace the problematic line with this:
WHILE NOT (InS.EOS) DO
InS.READ(InText);
but when it tries to execute these two line Navision Application Server crashes.
After I removed the problematic lines everything runs fine.
And here is the code in C#:
public Form1() { InitializeComponent(); mqFromNavision.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] { typeof(String) }); } private void mqFromNavision_ReceiveCompleted(object sender, System.Messaging.ReceiveCompletedEventArgs e) { System.Messaging.Message m = mqFromNavision.EndReceive(e.AsyncResult); txtReceive.Text = (string)m.Body; } private void btnSend_Click(object sender, EventArgs e) { mqToNavision.Send(txtSend.Text, "Navision MSMQ-BA"); mqFromNavision.BeginReceive(new System.TimeSpan(0, 0, 0, 30)); }The test is running on a Windows 2003 Server (32bit), and Message Queue log looks fine if I comment out the problematic lines. It is two Public Queues (fromNavision, toNavision). In queue log I can see the text I have sent from C# and I can see 'Hello World' that I'm sending back from navision also.
Any help would might come in handy!
Thanks.
I followed the steps described here: http://msdn.microsoft.com/en-us/library/ms952182.aspx
0
Comments
-
Take a look at this guide. Maybe it helps you."Money is likewise the greatest chance and the greatest scourge of mankind."0
-
einsTeIn.NET wrote:Take a look at this guide. Maybe it helps you.
Hi!
Thanks for your reply it is a good guide for XMLDom. But when I take out from the picture the whole XMLDOM and just trying to read the InStream into a text variable, the same error raises.0 -
Lets simplify the problem, so I have removed XMLDom:
OBJECT Codeunit 55085 NAS receive { OBJECT-PROPERTIES { Date=10.10.28; Time=12:35:50; Modified=Yes; Version List=NAS_VD2.09as PDP; } PROPERTIES { SingleInstance=Yes; OnRun=BEGIN IF ISCLEAR(ComCom) THEN CREATE(ComCom); IF ISCLEAR(MSMQBus) THEN CREATE(MSMQBus); MSMQBus.OpenReceiveQueue('.\private$\myQueue',1,1); ComCom.AddBusAdapter(MSMQBus,1); END; } CODE { VAR ComCom@1000000004 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{01018FA5-E4B4-413C-A47C-AD34B0CC2647}:'Navision Communication Component version 2'.CommunicationComponent" WITHEVENTS; InMsg@1000000002 : Automation "{F9A57667-8AC5-45C5-9416-99D3955BCAC0} 1.0:{D184D0AC-61C9-4AC1-B537-0D28C277FEDE}:'Navision Communication Component version 2'.InMessage"; MSMQBus@1000000001 : Automation "{B8BD635A-E191-47EF-84A0-02921E2A44A6} 1.0:{CD49794B-0E84-4A2E-9522-C518C825D390}:'Navision MS-Message Queue Bus Adapter'.MSMQBusAdapter"; InStr@1000000000 : InStream; Line@1000000003 : Text[250]; EVENT ComCom@1000000004::MessageReceived@1(VAR InMessage@1000000000 : Automation ":{00020400-0000-0000-C000-000000000046}:''.IDISPATCH"); BEGIN InMsg := InMessage; InStr := InMsg.GetStream; InStr.READTEXT(Line); //<------------- ERROR RAISES HERE MESSAGE(Line); END; BEGIN END. } }
InStr.READTEXT(Line); Fin.exe client crashes here.0 -
Meehi,
I had that problem too and I got around it with the following:MSMQBus.OpenReceiveQueue('.\private$\myQueue',1,1);
Changed it to:MSMQBus.OpenReceiveQueue('.\private$\myQueue',0,0);
Also what are the security settings on the message queue?
Make sure everyone has the right to read.
Hope this helps,
Regards,
WillyFostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.0 -
Hi KYDutchie,
thanks for your answer. I tryed what you write but still doesn't work. I'm running the code with a domain user who has full access to that queue, and also added full access to everyone.
Are you sure that you didn't changed anything else in your code to get it work?0 -
About the queue itself:
- it must be a private queue
- it cannot be a transactional queue. The busadapter doesn not know how to deal with a transactional queue
I've also had issues when anything other than just the standard MSMQ core is installed. As soon as AD services was added, I started having problems with receiving messages. All you need is the core, nothing else. This is a limitation of the MSMQ bus adapter.0 -
Problem solved:
1) I had to unregister all the dll files in C:\Program Files\Common Files\Navision\Communication Component folder with regsvr32 /u
2) Copy and overwrite all dll files with the newest Communication compenents
3) New dll files need to be registered with regsvr32
Thats worked for me.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