Export (0) Print
Expand All

Lesson 3: Creating the Initiator Conversation Objects

In this lesson, you will learn to build all the objects that enable a database to initiate a conversation with another database.

Switch to the InitiatorDB database

  • Copy and paste the following code into a Query Editor window. Then, run it to switch context to the InitiatorDB database.

    USE InitiatorDB;
    GO
    

Create the message types

  • Copy and paste the following code into a Query Editor window. Then, run it to create the message types for the conversation. The message type names and properties that are specified here must be identical to the ones that were created in the TargetDB in the previous lesson.

    CREATE MESSAGE TYPE [//BothDB/2DBSample/RequestMessage]
           VALIDATION = WELL_FORMED_XML;
    CREATE MESSAGE TYPE [//BothDB/2DBSample/ReplyMessage]
           VALIDATION = WELL_FORMED_XML;
    GO
    

Create the contract

  • Copy and paste the following code into a Query Editor window. Then, run it to create the contract for the conversation. The contract name and properties that are specified here must be identical to the contract that was created in the TargetDB in the previous lesson.

    CREATE CONTRACT [//BothDB/2DBSample/SimpleContract]
          ([//BothDB/2DBSample/RequestMessage]
             SENT BY INITIATOR,
           [//BothDB/2DBSample/ReplyMessage]
             SENT BY TARGET
          );
    GO
    

Create the initiator queue and service

  • Copy and paste the following code into a Query Editor window. Then, run it to create the queue and service that is used for the initiator. Because no contract name is specified, no other services can use this service as a target service.

    CREATE QUEUE InitiatorQueue2DB;
    
    CREATE SERVICE [//InitDB/2DBSample/InitiatorService]
           ON QUEUE InitiatorQueue2DB;
    GO
    

You have successfully configured the InitiatorDB and TargetDB to support a conversation between the two databases. Next, you will complete a conversation that uses the configuration. See Lesson 4: Beginning a Conversation and Transmitting Messages.

Community Additions

ADD
Show:
© 2015 Microsoft