Hi,
I have gone over and over my (very simple) script but can't see the cause of
the error "The target service name could not be found. Ensure that the
service name is specified correctly and/or the routing information has been
supplied." . The code is shown below. Please, please can someone enlighten
me in this new area.
Thanks.
CREATE MESSAGE TYPE TESAMessage
VALIDATION = NONE
GO
CREATE CONTRACT TESAContractInitiator
(TESAMessage SENT BY INITIATOR)
GO
CREATE PROCEDURE usp_GetTESAMessage
AS
DECLARE @msgBody XML,
@convID uniqueidentifier,
@email varchar(512),
@msgType varchar(256);
DECLARE @msgTable TABLE
(
message_body xml,
conversation_handle uniqueidentifier,
message_type_name nvarchar(256)
);
BEGIN
WAITFOR
(
RECEIVE TOP (1) message_body, conversation_handle, message_type_name
FROM TESAMessageQueue INTO @msgTable
), TIMEOUT 2000;
SET @msgBody = (SELECT TOP (1) CAST(message_body AS XML) FROM @msgTable);
SET @msgType = (SELECT TOP (1) message_type_name FROM @msgTable);
SET @convID = (SELECT TOP (1) conversation_handle FROM @msgTable);
-- this'll really be an email afterwards
insert into msgTable(message_body, conversation_handle, message_type_name)
values (@msgBody, @msgType, @convID)
END CONVERSATION @convID
END
GO
CREATE QUEUE TESAMessageQueue
WITH
STATUS = ON,
RETENTION = OFF,
ACTIVATION
(
STATUS = ON,
PROCEDURE_NAME = usp_GetTESAMessage,
MAX_QUEUE_READERS = 5,
EXECUTE AS SELF
);
create SERVICE TESASenderService
ON QUEUE TESAMessageQueue (TESAContractInitiator)
go
create SERVICE TesaReceiverService
ON QUEUE TESAMessageQueue (TESAContractInitiator)
GO
DECLARE @conversationHandle UNIQUEIDENTIFIER
DECLARE @message NVARCHAR(100)
SET @message = '<mymessage>does it work3?</mymessage>'
BEGIN DIALOG @conversationHandle
FROM SERVICE TESASenderService
TO SERVICE 'TESAReceiverService'
ON CONTRACT TESAContractInitiator
WITH ENCRYPTION = OFF;
SEND ON CONVERSATION @conversationHandle
MESSAGE TYPE [TESAMessage]
(@message);
END CONVERSATION @conversationHandle
GO
Joe - 21 Apr 2006 17:15 GMT
Arghhhhhh! I have overcome the previous error (type-sensitive service
names).
Now something is read onto the queue and taken off, sys.transmission_queue
reports no errors, but the log values are all NULL!!!
I'm a step closer but really still have no idea what is going wrong - this
should be reproducible from the previous script if anyone can help out (many
TIA if you can take a look).
Joe
Niels Berglund - 21 Apr 2006 18:09 GMT
> Now something is read onto the queue and taken off,
> sys.transmission_queue reports no errors, but the log values are all
> NULL!!! I'm a step closer but really still have no idea what is going
> wrong - this should be reproducible from the previous script if anyone
> can help out (many TIA if you can take a look).
When you say that something is read onto the queue and taken off, I
assume you deduce that 'cause you see some values in the msgTable but
they are null?
If so, can you to begin with change your queue so it doesn't activate
the proc. I.e. the messages should stay on the queue. That way you can
see what exactly happens. Also, to begin with - do not end the
coversation after send.
Niels

Signature
**************************************************
* Niels Berglund
* http://staff.develop.com/nielsb
* nielsb at develop dot com
* "A First Look at SQL Server 2005 for Developers"
* http://www.awprofessional.com/title/0321180593
**************************************************