Hello,
I'm trying to do a very simple example of sending a message from Initiator queue to Target queue. The result is no messages are delivered.
Here's the code:
DECLARE
@conversationHandle UNIQUEIDENTIFIERBEGIN
DIALOG CONVERSATION @conversationHandle FROM SERVICE GmiInitiatorService TO SERVICE 'GmiTargetService' ON CONTRACT GmiContract WITH ENCRYPTION = OFF;SEND
ON CONVERSATION @conversationHandle MESSAGE TYPE GmiMessage ('test');END CONVERSATION @conversationHandle
All three queues are empty (Initiator, Transmission, Target). When I comment out the last line ("end conversation"), the messages get stuck in the Initiator queue.
Please help!!
Thank you.

No messages in the queues.
Robertwell
Phil Wherrett
Sanjay G
Thanks for your help, guys.
I found what the problem was. The services weren't tied to any contract.
I had to run the following two commands:
ALTER
SERVICE [GmiInitiatorService] (ADD CONTRACT [GmiContract]) ;ALTER
SERVICE [GmiTargetService] (ADD CONTRACT [GmiContract]) ;Biri
You need to do that only for the target service, by the way.
In general, is better when you post with a problem to add the complete DDL you use, we could had spotted the problem just by looking at the CREATE SERVICE.
joost g.
Jian Hu
Use CAST or CONVERT. E.g.:
RECEIVE cast(message_body as xml) FROM queuename
SELECT cast(message_body as xml) FROM queuename
SELECT cast(message_body as nvarchar(max)) FROM queuename
etc...
Claudio Maras
How do I give permissions to the target service
Thanks.
iHD
Thanks.
The message body says "The service contract 'GmiContract' is not found."
I checked the contract and it's there. GmiContract.
surajguru
When you don't end the conversation, the message you are seeing in the initiator queue is probably an error message sent by the target service. This could be due to security or metadata issues. Look at the message body to find out more.
As a rule, you should not end the conversation if you care about error messages being sent by the target.
Raj-Xps