Dela via


Include a Two-Way Relay Endpoint

 

Important

Microsoft Azure BizTalk Services (MABS) is being retired, and replaced with Azure Logic Apps. If you currently use MABS, then Move from BizTalk Services to Logic Appsprovides some guidance on moving your integration solutions to Logic Apps.

If you're brand new to Logic Apps, then we suggest getting started here:

Add a two-way relay endpoint to a BizTalk Service project. Use this destination to route a message to relay endpoint that takes a request and gives a response.

Important

The relay endpoint you wish to represent as part of the BizTalk Service project must already be configured. You cannot configure a relay endpoint as part of the BizTalk Service project.

To add a two-way relay endpoint to a BizTalk Service project

  1. Create a BizTalk Service project, as described in Get started with a Visual Studio project.

  2. Right-click anywhere on the BizTalk Service project design area, select Properties. For the BizTalk Service URL property, enter your BizTalk Services URL.

  3. From the Toolbox, drag and drop the Two-Way Relay Endpoint component to the BizTalk Service project design area.

    Note

    This adds a configuration file to the BizTalk Service project. For more information about the configuration file, see No text is specified for bookmark or legacy link '360614a1-ccb9-4d8d-b6cc-52bcba6888e5#BKMK_Config'..

  4. Right-click the component, and then select Properties. The following table provides information about the properties:

    Property Name

    Description

    Associated Project Item

    This is a read-only field and provides the name of the associated .config file. If you change the name of the component on the BizTalk Service project design area by changing the No text is specified for bookmark or legacy link '360614a1-ccb9-4d8d-b6cc-52bcba6888e5#BKMK_EntityName'. property, the name of the .config also changes.

    Endpoint Configuration Name

    Name of the client endpoint configuration in the .config file that defines the address, binding, and contract for the WCF relay service that you are representing on the BizTalk Service project design area. Because the service configuration file can have any number of endpoints defined, the endpoint name you enter for this property is matched with the endpoint configuration name in the .config file. When a match happens, the corresponding address, binding, and contract for that endpoint are considered.

    Important

    The value you specify for this property is not used for updating the name attribute of the endpoint element in the associated .config file.

    Important

    You must ensure that the associated .config file has at least one endpoint defined with the name you enter here. You can either update the .config manually to create the endpoint or use the Service Configuration Editor, as explained in No text is specified for bookmark or legacy link '360614a1-ccb9-4d8d-b6cc-52bcba6888e5#BKMK_ServiceConfigEditor'..

    Entity Name

    The name of the relay endpoint component on the BizTalk Service project design area. This name should be unique for a BizTalk Service project.

    Runtime Address

    The public runtime endpoint URL where the relay service is deployed.

    1. When you drop the Two-Way Relay Endpoint component on the BizTalk Service project design area, it adds a configuration file with the same name as the value you provided for the Entity Name. This configuration file must be updated to provide information about the client endpoint for the relay such as the service binding and service contract. Perform the following steps to update the configuration file.

      1. From the Solution Explorer, right-click the .config file for the Two-Way Relay Endpoint component, and then select Edit WCF Configuration to open the Service Configuration Editor.

      2. Expand the Endpoints node under the Client node in the Tree View pane, and then select New Client Endpoint. In the Client Endpoint details pane, in the General tab, enter the following properties.

        Property Name

        Description

        Name

        Enter the endpoint name, for example, TwoWayRelay.

        Important

        Whatever value you enter here, you must enter the same value for the No text is specified for bookmark or legacy link '360614a1-ccb9-4d8d-b6cc-52bcba6888e5#BKMK_EndpointConfig'. property.

        Address

        The address where the relay endpoint is hosted on the Service Bus. You must update the address to include your Service Bus namespace and the complete URL for the relay service.

        BehaviorConfiguration

        If you want to include a custom endpoint behavior configuration, and if you already have it configured as part of the Service Configuration Editor under the Endpoint Behaviors node, you can select that from the drop-down list. For instructions on how to add a behavior configuration, see To add a behavior configuration.

        Binding

        Specifies the type of binding you want to use for the endpoint. For example, for a relay endpoint, you can choose basicHttpRelayBinding.

        BindingConfiguration

        Using this you can specify more details about the binding such as security requirements, and so on. If you want to include a binding configuration, and if you already have it configured as part of the Service Configuration Editor under the Bindings node, you can select that from the drop-down list. For instructions on how to add a binding configuration, see To add a binding configuration.

        Contract

        Specify the contract for the service. For a two-way relay endpoint, the contract must be System.ServiceModel.Routing.IRequestReplyRouter.

        3. From the File menu, select **Save**, and then select **Exit**. 4. Open the configuration file and verify that the values you entered in the Service Configuration Editor are reflected in the configuration file. A sample configuration file for a two-way relay endpoint would look like the following:

        To add a behavior configuration

        1. In the Service Configuration Editor, from the Tree View pane, expand Advanced, right-click Endpoint Behaviors, and then select New Endpoint Behavior Configuration.

        2. In the Behavior details pane, enter a name for the behavior, for example, ServiceCredentialBehavior. The same name is available in the BehaviorConfiguration drop-down list in Step 4(b) above.

        3. In the Behavior element extension position area, select Add, from the Available Elements box, select transportClientEndpointBehavior, and then select Add again. You must add this element to specify the Service Bus credentials for a particular endpoint.

        4. In the Tree View pane, go back to the service endpoint that you created, and select the newly created endpoint behavior configuration from the BehaviorConfiguration drop-down list.

        5. If you save and exit the configuration editor now, and open the configuration file in an XML editor, you notice that the following has been added to the service configuration file:

          <behaviors>
            <endpointBehaviors>
              <behavior name="ServiceCredentialBehavior">
                <transportClientEndpointBehavior>
                  <clientCredentials>
                    <sharedSecret issuerName="" issuerSecret="" />
                  </clientCredentials>
                  <tokenProvider>
                    <sharedSecret issuerName="" issuerSecret="" />
                  </tokenProvider>
                </transportClientEndpointBehavior>
              </behavior>
            </endpointBehaviors>
          </behaviors>
          
        6. For a Service Bus relay endpoint, you only need to include the token credentials. So, you must remove the clientCredentials element and add the value for Issuer Name and Issuer Secret for the tokenProvider credentials. The section of the configuration file would now resemble the following:

          <behaviors>
            <endpointBehaviors>
              <behavior name="ServiceCredentialBehavior">
                <transportClientEndpointBehavior>
                  <tokenProvider>
                    <sharedSecret issuerName="owner" issuerSecret="**********************" />
                  </tokenProvider>
                </transportClientEndpointBehavior>
              </behavior>
            </endpointBehaviors>
          </behaviors>
          

        To add a binding configuration

        1. In the Service Configuration Editor, from the Tree View pane, right-click Bindings, and then select New Binding Configuration.

        2. In the Create a New Binding box, select the same binding that you specified in Step 4(b) above, and then select OK.

        3. In the binding details pane, on the Binding tab, for the Name property, specify a name for the binding configuration, for example, ServiceBinding. The same name will be available in the BindingConfiguration drop-down list in Step 4 (b) above.

        4. In the Tree View pane, go back to the service endpoint that you created, and select the newly created binding configuration from the BindingConfiguration drop-down list.

        5. If you save and exit the configuration editor now, and open the configuration file in an XML editor, you will notice that the following has been added to the service configuration file. This excerpt assumes that the binding you selected was basicHttpRelayBinding.

          <bindings>
            <basicHttpRelayBinding>
              <binding name="ServiceBinding" />
            </basicHttpRelayBinding>
          </bindings>
          
        6. For a Service Bus relay endpoint, you must add the security element and set the mode and relayClientAuthenticationType attributes for the element. The section of the configuration file would now resemble the following:

          <bindings>
            <basicHttpRelayBinding>
              <binding name="ServiceBinding">
                <security mode ="Transport" relayClientAuthenticationType ="RelayAccessToken" />
              </binding>
            </basicHttpRelayBinding>
          </bindings>
          

          Setting relayClientAuthenticationType to RelayAccessToken specifies that the clients of the service are required to present a security token issued by Access Control to the Service Bus when sending messages.

        See Also

        Add a Message Destination to the bridge