Step 2: Expose a Relay Endpoint to Invoke Operations on ORDERS05 IDOC
Updated: November 27, 2015
There are two main steps required to expose an SAP artifact 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 running 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 system using the LOB Target configuration.
For more information, see BizTalk Adapter Service Architecture. In this topic, we create an LOB Target and an LOB Relay to expose the Send operation on the ORDERS05 IDOC.
To create an LOB Target and LOB Relay
Open Visual Studio (as an administrator), create a new BizTalk Service project, and name it SAPIntegration.
You first start with adding a BizTalk Adapter Service server. This is the server where you installed the Runtime component of BizTalk Adapter Service. To add a BizTalk Adapter Service server, from the Server Explorer in Visual Studio, right-click BizTalk Adapter Services, and select Add BizTalk Adapter Service. In the Add BizTalk Adapter Service dialog box, enter the URL of the WCF service that monitors that Service Bus relay service, and then select OK:
Because you have all the components of BizTalk Adapter Service installed on the same computer, the URL for that service will be http://localhost:8080/BAService/ManagementService.svc/.
If you had installed BizTalk Adapter Service Runtime component on a separate computer, you replace ‘localhost’ in the above URL with the name of that computer.
In this tutorial, we are creating an application to integrate with SAP, so we must add an SAP target. Expand the newly added server, expand LOB Types, right-click SAP, and select Add SAP Target:
The Add a Target wizard starts. Perform the following steps to create an LOB Target.
Read the information on the Before You Begin page, and then select Next.
On the Connection Parameters page, specify the details for the SAP Server to connect to and the credentials to use for the connection. Select Next.
On the Operations page, expand the ORDERSO5 IDOC category (under \IDOC\ORDERS\). There are several versions of the IDOC available. For this tutorial, we’ll select ORDERS05.V3(700). Expand this IDOC, select Send, and then select the right arrow to add it to the Selected Operations box:
In the Runtime Security page, specify the security mechanism to be used by the LOB Server to authenticate the target resource when a message arrives from a client. For this tutorial, select Fixed Username and specify the credentials to connect to the SAP server.
On the Deployment page, you create an LOB Relay and an LOB Target to provide connectivity to your on-premise LOB applications from the cloud.
Select the Create new option to create a new relay and provide the following values:
Specify the Service Bus namespace on which the LOB relay endpoint is created.
Specify the issuer name for the Service Bus namespace
Specify the issuer secret for the Service Bus namespace
Specify a name for the relay. For this tutorial, enter sapintegration01.
Enter a sub-path to make this target unique. For this tutorial, enter orders.
The Target runtime URL 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 SAP Server. In our scenario, this is where the bridge sends the message.
On the Summary page, review the values you specified in the previous steps, and then select Create.
When the wizard completes, select Finish.
In Visual Studio Server Explorer, you now have an entry under the SAP node. This represents the relay endpoint created in Service Bus to relay PO messages coming from the cloud to the on-premises SAP system.
To add schemas
After adding the relay endpoint to an SAP system, you must add schemas that to send ORDERS05 PO messages to the SAP server. To add the schemas, right-click the relay endpoint and select Add schemas to SAPIntegration. In the dialog box, do the following:
Enter a filename prefix that will be included in the name of each schema file that is generated. For this tutorial, specify this as SAPIntegration_.
Enter a folder name that will be added to your solution under which all the schemas will be added. For this tutorial, specify the folder name as LOB Schemas.
Enter the credentials to connect to an SAP system.
Select OK. The schemas are added to the project under an LOB Schemas folder.
To use the LOB Target
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 that you provided in Azure Management Portal while provisioning the BizTalk Services.
Set the security property for the relay endpoint:
Right-click the LOB Target in Server Explorer and select Properties.
In the Properties grid, select the ellipsis (…) against the Runtime Security property.
In the Edit Security dialog box, select Fixed Username, and enter the username and password to connect to the SAP Server.
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 sapintegration01_orders.
Open the .config file for the LOB Target, which typically has the naming convention as YourRelayPath_target-sub-path.config. Specify 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.