Hi vt011,
Basically I follow the tutorial that I mention in my post before. I already write the c/al code in navision, and also in .net. I try to send the message from my winform via MSMQ and I want NAV to retrieve my message and convert it to uppercase before sending it back to my winform.
Below are my c/al code:
Documentation()
OnRun()
CREATE(MQBus);
CREATE(CC2);
CREATE (XMLDom);
CC2.AddBusAdapter(MQBus,1);
MQBus.OpenReceiveQueue(’.\Private$\ToNavision’,0,0);
MESSAGE(‘on run() initiate’);
CC2::MessageReceived(VAR InMessage : Automation “’’.IDISPATCH”)
// get the message
MESSAGE(‘message received’) ;
InMsg := InMessage;
InS := InMsg.GetStream();
// load the message into an XML document and find a node
MESSAGE (‘message load into xml doc n find the node’);
XMLDom.load (InS);
XMLNode := XMLDom.selectSingleNode (‘string’);
// open the response queue and create a new message
MESSAGE (‘open queue n create new message’) ;
MQBus.OpenWriteQueue(’.\Private$\FromNavision’,0,0);
MQBus.SenderAuthenticationLevel:= 2;
OutMsg := CC2.CreateoutMessage(‘Message queue://.\Private$\FromNavision’);
OutS := OutMsg.GetStream();
// build the contents of your message
MESSAGE (‘change to uppercase’);
XMLNode.text := UPPERCASE (XMLNode.text);
// fill the message and send it
ERROR (‘send the message’);
OutS.WRITE(XMLDom.xml);
OutMsg.Send(0);
If you noticed, I put a message in every process that the message went through before it’s send back to my winform (e.g MESSAGE(‘on run() initiate’);,MESSAGE(‘message received’);, etc).
Ok. Now when I run my winform, the message will be create in my private queue in journal folder. But after awhile, I get “Timeout for the requested operation has expired” exception message.
So when I check my event viewer, in the last event log, it become warning event log.
By the way, what is the msmq rules? How I’m suppose to do it?
Regards
-Khairul-