Hi,
I'm using two messages queues as a way of sending commands to Navision so that it can send back some data.
I have a .NET application that creates a simple XML packet that is pushed onto a request queue. I have a form in Navision that when run, parses incoming messages and sends a reply to the reply queue if required.
However, when it comes to sending a reply back on the reply queue, I get the following message:
The call to member Send failed. MSMQBusAdapter.MSMQBusAdapter.1 returned the following message: The queue could not be used to write messages. Check access rights, validity and settings
This message appears when I call the Send method for the Navision Communication Component.
The code I am using to send a reply is the following which is in the MessageReceived event for the Navision Communication Component:
CREATE(XMLDocRequest);
CREATE(XMLDocReply);
InMsg := InMessage;
InStreamQueue := InMsg.GetStream();
XMLDocRequest.load(InStreamQueue);
ProcessRequest(XMLDocRequest,XMLDocReply,ReplyReqd);
IF ReplyReqd THEN BEGIN
OutMsg := InMsg.CreateReply();
OutStreamQueue := OutMsg.GetStream();
XMLDocReply.save(OutStreamQueue);
OutMsg.Send(0); // Debugger breaks here with error message.
CLEAR(OutMsg);
END;
InMsg.CommitMessage;
CLEAR(InMsg);
CLEAR(XMLDocReply);
CLEAR(XMLDocRequest);
Any help or pointers with this would be greatly appreciated!
Thanks,
Matthew
Answers
Normally I always start by granting everyone full permissions on both message queues for testing (just so everything works) then as you're ready to put the Web Service/.Net/Com/Whatever Application into production make sure to tighten security as requied.
Epimatic Corp.
http://www.epimatic.com
I'm running the .NET application and Navision on my development PC so I'm simply allowing both of these applications to talk directly to the queue without NAS.
I've checked the permissions for the reply queue and all available groups or users have the necessary permissions to send a message.
Next things to look into is how are you sending the message - do you have the correlation ID and the message labels setup correctly?
Another thing...are you trying to use the same Message Queue for reading & writing? If so you may want to try splitting it out into 1 queue per direction per nas.
Epimatic Corp.
http://www.epimatic.com
I have managed to get a reply writing to the correct queue. When sending the message through to Navision you have to specify the response queue that the message will reply to in the original message. Simply specifying the reply queue in Navision isn't enough.
So I amended my C# application to specify the response queue like so:
Top tip: You can see more properties for a message on the message queue by viewing the message in the server explorer in Visual Studio rather than using the Computer Management console.
Thanks for the suggetions jlandeen. Finally got there in the end!
Epimatic Corp.
http://www.epimatic.com