Retrieving MSMQ message
sbhamidi
Member Posts: 22
Hello,
I'm trying to retrieve messages from the MSMQueue in Navision. I create the messages in ASP. Here's my Navision code
The function Comcom::MessageReceived is supposed to receive the messages from MSMQ. But when the "InStr := InMsg.GetStream" is executed, a blank value is assigned.
Now this works perfectly if the message was created within Navision itself and sent to MSMQ - so I'm perplexed.
Any help would be greatly appreciated.
I'm trying to retrieve messages from the MSMQueue in Navision. I create the messages in ASP. Here's my Navision code
[u]OnRun()[/u]
IF ISCLEAR(Comcom) THEN
CREATE(Comcom);
IF ISCLEAR(MQBus) THEN
CREATE(MQBus);
IF ISCLEAR(XMLDoc) THEN
CREATE(XMLDoc);
Comcom.AddBusAdapter(MQBus,1);
MQBus.OpenReceiveQueue('edi\private$\myq',1,1);
[u]FindNode(RootNode : Automation "'Microsoft XML, v3.0'.IXMLDOMNode";XMLNode : Automation "'Microsoft XML, v3.0'.IXMLDOMNode") XmlString [/u]
CLEAR(XMLNode);
XMLNode := RootNode.selectSingleNode('string');
IF ISCLEAR(XMLNode) THEN
XmlString := ''
ELSE
XmlString := XMLNode.text;
[u]Comcom::MessageReceived(VAR InMessage : Automation "''.IDISPATCH")[/u]
InMsg := InMessage;
InStr := InMsg.GetStream;
XMLDoc.load(InStr);
Line := FindNode(XMLDoc,XMLDoc);
MESSAGE(Line);
The function Comcom::MessageReceived is supposed to receive the messages from MSMQ. But when the "InStr := InMsg.GetStream" is executed, a blank value is assigned.
Now this works perfectly if the message was created within Navision itself and sent to MSMQ - so I'm perplexed.
Any help would be greatly appreciated.
0
Comments
-
Your MSMQ message must have a label "Navision MSMQ-BA" in order for the Navision MSMQ adapter to pick it up. When you send a message with Navision, the adapter adds the label for you, but if you program the message outside of Navision you have to program it yourself.0
-
Hello,
Thanks for the response. I do have that label. I had already researched that part. Any more ideas?
Thanks in advance0 -
Do you send an MSDOM object into the queue? I couldn't get a regular XML string to work, and when I changed it to an MSDOM object it worked.0
-
In my ASP page, I'm actually creating an xml string like this -
<order><no>12345</no></order>
And then I'm just sending this string to the MSMQ. I'm not really sending an XML doc. Maybe I should try the same thing you did. I will keep you posted. I will get a chance to know by wednesday.
I really appreciate your suggestion.
Thanks0 -
I have made the change to send an XMLDOM object to the MSMQ. It still does not work. I had MBS support take a look at the code. It works on their end. I even had them shadow my desktop.
The only difference they said was that the message in the Queue on their end has the XML version in front of the actual xml data. On my end, it's a bunch of special characters before the xml data.
MBS support guy used a C# form to generate the xml message. They used the following, where mqFromNavision is the message queue object:mqFromNavision.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] {typeof(String)});ASP does not have the method they're using. Has anyone worked on a similar problem? Please help!
Thanks in advance0 -
What type of special characters? Could it be that your text is actually unicoded? MSDN - Byte-order Mark.
Have you had XMLDom given you the reason why it complains?XMLDoc.load(InStr); IF (XMLDoc.parseError.errorCode <> 0) THEN BEGIN myErr := XMLDoc.parseError; MESSAGE('You have error ' + myErr.reason + ' - ' + myErr.srcText + '-' + FORMAT(myErr.linepos)); END;
Can you share the characters that you are trying to load?
Br,
Jorge_________________
“This posting is provided "AS IS" with no warranties, and confers no rights.”0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
