Step 5(b): Create LOB Relay and LOB Targets for the Insert Operation

 

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:

There are two main steps for exposing an SQL Server table operation as an operation that can be invoked by sending a message over Service Bus – create an LOB Target and an LOB Relay.

  • An LOB Target defines how an Azure application communicates to the Line-of-Business (LOB) system. The LOB Target controls the LOB system connection URI, the operation to perform, and the connection credentials.

  • An LOB Relay is a WCF service that runs within an organizations firewall and listens to a relay endpoint on the Service Bus. As the name suggests, the LOB Relay acts as a relay between the Service Bus relay endpoint and the LOB system. It receives the message at the Service Bus relay endpoint and passes it on to the relevant LOB application by using the LOB Target configuration.

For more information, see BizTalk Adapter Service Architecture. This topic demonstrates how to create an LOB Target and an LOB Relay to expose the Insert operation on the Claims table in the SQL Server database.

To create an SQL Server LOB Target

  1. In the BizTalk Service project, open Server Explorer, right-click BizTalk Adapter Service, and then select Add Server. In the dialog box that pops up, enter the BizTalk Adapter Service Management URL. The BizTalk Adapter Service Management URL is path to the ManagementService.svc WCF service hosted in IIS. This management service monitors the Service Bus relay service hosted on Microsoft Azure. Runtime Components: BizTalk Adapter Service provides more information on the BizTalk Adapter Service components within IIS.

    Add Service Bus Connect Server

    Because you have all the components – BizTalk Services as well as BizTalk Adapter Service, installed on the same computer, the URL for that service will be https://localhost:8080/BAService/ManagementService.svc/.

    Note

    If you had installed BizTalk Adapter Service Runtime component on a separate computer, you would have replaced ‘localhost’ in the above URL with the name of that computer.

    Click OK.

  2. Expand the newly added server, expand LOB Types, right-click SQL, and select Add SQL Target.

    Add an SQL LOB Target

    The Add a Target wizard starts.

    1. Read the information on the Before You Begin page, and then click Next.

    2. On the Connection Parameters page, enter the details for the SQL Server to connect to and the credentials to use for the connection. Click Next.

      Note

      You can use the Advanced button to build the SQL Server connection URI and also enter the binding properties for the connection.

      The SQL Server Connection URI provides additional information about how to build the URI. For information about binding properties, see Working with BizTalk Adapter for SQL Server Binding Properties.

      For this tutorial, leave the default setting as-is for the binding properties.

    3. On the Operations page, from the left box, expand Tables, expand Claims, select Insert, and then click the RIGHT ARROW. Notice that the Insert operation is listed under the Selected operations section.

      Select Operation on the SQL Server table

      Click Next.

    4. In the Runtime Security page, enter the security type. This security type determines how the client message is authenticated with the LOB Target. Options include:

      Fixed Username

      Select this option if you are using a username and password created locally on the LOB system.

      Fixed Windows credential

      Select this option to use a Windows domain account.

      Custom SOAP Header

      Select this option if you create a custom SOAP header to include the username and password.

      Message Credential

      Select this option if you are including the logon credentials in the WS-Security header of the message.

      For this tutorial use the Fixed Windows credential option, enter the credentials, and then click Next.

    5. On the Deployment page, choose an existing LOB Relay or create a new LOB Relay.

      Tip

      A single LOB Relay can be used with multiple LOB Targets. There are some restrictions based on the security model. As a best practice, group the same security method in one LOB Relay. For example, use the same LOB Relay to host the LOB Targets that use Message Credential or Fixed Windows security type.

      To create a new LOB Relay, enter the following details:

      Namespace

      Enter the Service Bus namespace on which the LOB relay endpoint is created.

      Issuer Name

      Enter the issuer name for the Service Bus namespace

      Issuer Secret

      Enter the issuer secret for the Service Bus namespace

      Relay Path

      Enter a name for the relay. For this tutorial, enter SQLLOBRelay.

      Target Sub-path

      Enter a sub-path to make this target unique. For this tutorial, enter Claims.

      Target runtime URL

      This read-only property displays the URL where the relay is deployed on Service Bus. This is the path where you could send a message to be inserted into the on-premises SQL Server. In our scenario, this is where the bridge routes the message.

      Click Next.

    6. On the Summary page, review the values you specified in the previous steps, and then click Create.

    7. When the wizard completes, click Finish. The following activities occur in the background:

      • An LOB Target is created in Server Explorer. It can be disabled, started, and deleted. Its configuration can also be exported.

      • An LOB Target is created as an application in IIS. This application uses the Runtime for this specific LOB Target. Runtime Components: BizTalk Adapter Service describes the IIS components.

  3. Save changes to the project.

To use the LOB Target

  1. Right-click anywhere on the BizTalk Service project design surface, select Properties and verify that the BizTalk Service URL property is updated to include your BizTalk Services name. This is the name that you provided in Azure classic portal while provisioning the BizTalk Services.

  2. Set the security property for the relay endpoint.

    1. Right-click the LOB Target in Server Explorer and select Properties.

    2. In the Properties grid, click the ellipsis (…) against the Runtime Security property.

    3. In the Edit Security dialog box, select Fixed Windows Credentials and enter the username and password to connect to the SQL Server.

    4. Click OK.

  3. Drag and drop the LOB Target onto the design surface. Note the Entity Name property of the LOB Target. The default value is Relay-Path_target-sub-path. If using the examples above, it will be sqllobrelay_claims.

  4. Open the .config file for the LOB Target, which typically has the naming convention as YourRelayPath_target-sub-path.config. Enter the Service Bus issuer name and issuer secret, as shown below:

    <tokenProvider>
      <sharedSecret issuerName="owner" issuerSecret="<issuer_secret>" />
    </tokenProvider>
    

    Save changes to the config file.

See Also

Step 5: Create and Configure the LOB Target