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. } }
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.
Comments
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.
InStr.READTEXT(Line); Fin.exe client crashes here.
I had that problem too and I got around it with the following:
Changed it to:
Also what are the security settings on the message queue?
Make sure everyone has the right to read.
Hope this helps,
Regards,
Willy
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?
- 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.
RIS Plus, LLC
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.