Step 3: Create and Configure LOB Targets

 

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:

Connect to an on-premises LOB application by creating LOB Relays and LOB Targets in your BizTalk Services application. Development and Runtime Architecture: BizTalk Adapter Service describes how LOB Relays and LOB Targets manage connectivity with an on-premises LOB application.

For the scenario used in this tutorial, Northwind stores the sales order data in a SalesOrder SQL Server table. The steps in this section demonstrate how to create the SalesOrder SQL Server table, how to create an LOB Relay and LOB Target to write data into the table, and then finally generate the message schema for inserting data into the table. Specifically:

Create the SQL Server table

Create the SQL Server LOBTarget

Generate the schema

Create the SQL Server table

Use these steps to create the SalesOrder SQL Server table that contains the sales order data. You can create the table in a database called Orders.

  1. Open SQL Server Management Studio.

  2. Run the following query to create the SalesOrder table:

    CREATE TABLE [dbo].[SalesOrder] (
        [SalesOrderID] int IDENTITY(1,1) NOT NULL,
        [PartNum] int  NOT NULL,
        [DateRequested] datetime  NULL,
        [CompanyCode] varchar(3)  NOT NULL,
        [Qty] int  NOT NULL,
        [UnitAskPrice] float  NULL,
        [ShipDate] datetime  NOT NULL,
        [SellToAddress] varchar(255)  NULL,
        [BillToAddress] varchar(255)  NOT NULL,
        [PartnerContact] varchar(128)  NULL,
        [CustomerComments] varchar(500)  NULL,
        [RFQStatuesId] smallint  NULL
    );
    GO
    
  3. Confirm the table is created in the target database.

Create the SQL Server LOBTarget

Create the LOB Relay and LOB Target for the Insert operation on the SalesOrder table:

  1. In the EAIEDITutorial project, select the View menu, and then select Server Explorer.

    Note

    To create an LOB Relay, Visual Studio must be opened with administrator privileges.

  2. In Server Explorer, right-click BizTalk Adapter Services, and then select Add BizTalk Adapter Service. This prompts for the BizTalk Adapter Service Management URL. Enter the management URL. The BizTalk Adapter Service Management URL is the path to the ManagementService.svc WCF service hosted in IIS. Runtime Components: BizTalk Adapter Service provides more information on the BizTalk Adapter Service components within IIS.

    • If the BizTalk Adapter Service Runtime is installed locally with the default settings, enter: https://localhost:8080/BAService/ManagementService.svc/

    • If the BizTalk Adapter Service Runtime is installed remotely with the default settings, enter: https://ServerName:8080/BAService/ManagementService.svc/

    Select OK.

  3. Expand the newly added server, expand LOB Types, right-click SQL, and select Add SQL Target. The Add a Target wizard opens.

  4. In Before You Begin, select Next.

  5. In Connection Parameters, enter the SQL Server details and the credentials to use for the connection. Select 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 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.

  6. In Operations, expand Tables, expand SalesOrder, select Insert, and then select the right arrow. The Insert operation is now listed under the Selected categories section.

    Select Next.

  7. In Runtime Security, select Fixed Windows credential, enter the credentials, and then select Next.

    This security type determines how the client message is authenticated with the LOB Target. Options include:

    Fixed Username

    Use a username and password created locally on the LOB system.

    Fixed Windows credential

    Use a Windows domain account.

    Custom SOAP Header

    Use a custom-created SOAP header that includes the username and password.

  8. In Deployment, create a new LOB Relay or choose an existing one.

    Tip

    A single LOB Relay can be used with multiple LOB Targets. There are 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:

    Namespace

    Required. Enter your Service Bus namespace; the LOB relay is created in the Service Bus. The namespace name is available in the Azure classic portal.

    Issuer Name

    Required. The Service Bus Issuer Name, listed in the Azure classic portal.

    Issuer Secret

    Required. The Service Bus Issuer Secret key, listed in the Azure classic portal.

    Relay Path

    Required. Enter the desired name of the relay path. For this tutorial, set this property to OrderProcessing.

    Target Sub-path

    Required. Enter a sub-path to make this target unique. For example, you can enter SQLGetOrder.

    Target runtime URL

    This is automatically populated with the namespace name, relay path, and target sub-path you entered. If using the examples above, it is populated with something like:

    https://MyNamespace.servicebus.windows.net/OrderProcessing/SQLGetOrder

    Select Next.

  9. In Summary, review your values. Select Create.

When the wizard completes, select Finish. The following events occur in the background:

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

  • The 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.

To use the LOB Target

  1. Right-click anywhere on the BizTalk Service project design area, select Properties, and update the BizTalk Service URL property to include your BizTalk Services name. This is the name you entered in Azure classic portal when creating 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, select the ellipsis (…) next to the Runtime Security property.

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

    4. Select OK.

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

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

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

    Save changes to the config file.

Generate the schema

Generate the schema for the Insert operation on the SalesOrder table. You can use the LOB Target you created in the previous step.

  1. Right click the test01/orderprocessing/sqlgetorder entity in Server Explorer, and then select Add schemas To EAIEDITutorial.

    Note

    This menu property is enabled only if BizTalk Services project is open in Visual Studio.

  2. In Schema Generation, set the file name prefix to EAIEDITutorial_SalesOrder_, and leave the folder name to its default value of LOB Schemas.

    Select credential Type as Windows and then select OK.

    An LOB Schemas folder is created within the project and the generated schemas are added under it. The schema for the Insert operation on the SalesOrder table is created with the EAIEDITutorial_SalesOrder_TableOperation.dbo.SalesOrder.xsd name.

See Also

Create and Deploy the BizTalk Services Project