Using EDI Bridge to exchange B2B messages in Windows Azure Service Bus

My last demo will be an Electronic Data Interchange (EDI) Demo: This demo intends to show how to configure trading partners, agreements and the creation of EDI Bridges to process and exchange EDI messages to your partners. We will send a Sales Order message in an X12 Electronic Data Interchange (EDI) format using the X12 840 schema. The message will be processed by an EDI Bridge and will transform the EDI message into a SalesOrder schema (XML) and then routed it to an EAI Bridge (XML Bridge) that will send the SalesOrder directly to an on-premises SQL Server.

EDI-Bridge

Like the previous demos, this was also created using Windows Azure Service Bus EAI & EDI Labs – April 2012 release!

Note: Unfortunately this release only supports X12. EDIFACT will be supported in the future but for now, is not supported.

I will not show all the steps needed to develop this project, like create schemas, maps or EAI Bridge. You can learn this steps in my previous post:

Instead, I will focus on the configuration that we need to do to create our EDI Bridges.

Note: The source code of the project that is available to download will contain all the scripts to create the database used in this demo. The database in composed by one table:

  • SalesOrder (SalesOrderId, PartNum, DataRequest, CompanyCode, Qtd, UnitAskPrice, ShipDate, SellToAddress, BillToAddress, PartnerContact, CustomerComments and RFQStatusId)

EDI-sample-3-SQL

Create Service Bus EAI Project

Although this is an EDI demo, we still need to create an EAI Project. If you noticed, the image of the solution (on top), we can see that we have an EDI Bridge – this component will be created in the Windows Azure EDI Portal – that will send messages to an EAI Bridge. So we need to create an EAI project to developer this part of the solution and also to deploy the EDI Schema and the map that transform the EDI message to SalesOrder message (so all EDI artifacts except the Bridge)

The first thing, of course, is to create a new Visual Studio project:

  • Open Visual Studio 2010, on the File menu, point to New, and then click Project.
  • Under “Installed Templates”, select “Visual C# à “ServiceBus” template
  • And then select “Enterprise Application Integration” project type
  • Finally, give a name to your project: “EdiDemo”

By default “BridgeConfiguration.bcs” is open after we create a new project. For now, we will close this file (window).

After we create our project: “EdiDemo” we need to add the following files to our project:

  • “ECommerceSalesOrder.xsd”
  • The “LOB Schemas” folder that contains all the schemas needed to communicate with the SQL
  • “SalesOrderToSQLSalesOrderInsert.trfm”, which transforms the SalesOrder message into a SQL insert message.
  • “BridgeConfiguration.bcs”, XML Bridge that process, transform and transports the message to an on-premises SQL Server.

So basically we have an Enterprise Application Integration application that we already saw and know from the previous demos.

Now we will add two additional artifacts to our Enterprise Application Integration project:

  • “X12_00401_840.xsd” that you can find in the “MicrosoftEdiXSDTemplates.zip” file available for download here. This zip file contains all the X12 schemas supported in Windows Azure Service Bus EAI/EDI April release.
  • “Edi840ToSalesOrder.trfm”, map that transforms the EDI message to SalesOrder message;

Now we are ready to build our solution and deploy to the cloud!

After we deploy our project, the next step is to access the Windows Azure EDI Portal or (also known as TPM Portal) to create our Partners, Agreements and configure our EDI bridges.

Also, get insights on improving Azure Service Bus monitoring and messaging issues.

Create Partners in the Windows Azure EDI Portal (TPM Portal)

In this step, you will log into the Windows Azure EDI Portal, register the service provider, and create partners for SandroPereiraDevScope and MyPartnerA.

To create partners:

  • Log in to the portal
  • If you are logging in for the first time, you will need to register as a service provider. Service provider acts as a broker between two enterprises, which in this case are Northwind and Contoso. So, to continue with this, you must first register as a service provider. If the service provider is already registered, you can skip this step, and proceed to the next step.

Register-TPM-Portal

    • This will also create our default partner

Register-TPM-Portal-default

  • Add a new partner: MyPartnerA
    • On the portal home page, click Partners.
    • In the Partners page, click Add Partner.
    • In the New Partner page, enter the following details:
      • Partner name: Required. Enter the name of the partner. The name must be unique.
      • All other attributes are optional
      • Note: Managed Partner – Select this check box to identify the partner as a managed partner. A managed partner is managed by the service provider and the pipelines are deployed for that partner during agreement deployment. Typically partners managed by the service provider are configured as managed partner while the enterprise partners are not marked as managed partners. – leave this attribute unchecked.

TPM-new-partner

    • Click Save to add the partner.

Create Agreements Between Partner Profiles

Now that we already create our partners, we need to create an agreement between the two of them, so to specify the General Settings of an X12 agreement we need to:

  • On the portal home page, click Agreements.
  • On the Agreements page, click the X12 tab if you are not already on that tab. Then click Create Agreement.

TPM-create-new-agreement

  • In the New Agreement page, enter the following details:
    • Name: Enter a name for the agreement. For this tutorial, specify the name as Sandro_PartnerAX12.
      • This is a mandatory field and the name for the agreement must be unique.
    • Description: Enter notes or a description of the agreement. (optional)
    • Partner 1 Profile (managed): Select the managed partner for the agreement. In this case: SandroPereiraDevScope
    • Partner 2 Profile: Select the partner for the agreement (who is not a managed partner). In this case MyPartnerA
      • Note: The default profile is displayed in the Profile field. Choose the desired profile which has been configured for the partner.
    • Identities
      • Partner 1 ID Qualifier: Select an authenticating qualifier that provides unique business identities to the trading partners. For this tutorial, select ZZ-Mutually Defined.
      • Value: Enter US
      • Partner 2 ID Qualifier: For this tutorial, select ZZ-Mutually Defined.
      • Value: Enter THEM.
    • Tracking
      • Track Send side message properties: Check this to store the message properties when the EDI message is sent to the partner. Once stored, you can query this data by clicking Tracking on the TPM portal home page.
      • Track Receive side message properties: Check this to store the message properties when the EDI message is received from a partner. Once stored, you can query this data by clicking Tracking on the TPM portal home page.

TPM-create-new-agreement-2

  • Click Continue.
  • Clicking Continue adds two new tabs, one for receive settings and the other for send settings. Each tab is a one-way agreement between the two partners, one for receiving messages and the other for sending messages.
  • Specify the receive settings.
    • On the Transport page, set the Transport type to HTTP.
    • On the Protocol page, specify the following values.
      • Under Acknowledgements, select TA1 expected and 997 expected to receive acknowledgments from the partner receiving the message.
      • Under Schemas, click the Upload button and upload the X12 840 schema (you added in Step 1: Add the X12 SalesOrder (840) Schema to the Visual Studio Project) and the SalesOrder schema (you added in Step 2: Create SalesOrder Schema).
  • Set the following properties under the Schemas section.
    • Version: 00401
    • Transaction Type (ST1): 840
    • Sender Application (GS2): THEM
    • Schema: /X12_00401_840.xsd
    • On the Transform page, upload the transform you created in Step 1: Add the X12 SalesOrder (840) Schema to the Visual Studio Project.
      • Under Choose the maps you want to execute as part of this agreement, choose /X12_00401_840.xsd for Schemas and /EDI840ToSalesOrder.trfm for Transform file name.
    • On the Route page, select Route to Service Bus Bridge and provide the relative address of the XML One-Way Bridge that you deployed in Step 6: Build and Deploy the Project.

TPM-create-new-agreement-Workflow

  • Click Deploy Agreement to deploy the agreement. The agreement is now deployed at the URL that was displayed in the Transport page of the Receive Settings tab.

Now we are ready to test our EDI solution!

If you are a BizTalk Developer you may notice that the concepts of creating Partners and Agreements are pretty much the same as in BizTalk Server 2010:

  • The trading partners, define business profiles that are business entities within an organization.
  • How business profiles exchange messages is defined as part of trading partner agreements between two business profiles.

Unfortunately, I couldn’t detail more this article because the Portal is currently under maintenance and thus unavailable.

The sample code is available for download in Code Gallery:.

Using EDI Bridge to exchange B2B messages in Windows Azure Service Bus (502.4 KB)
Microsoft Code Gallery

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

1 thought on “Using EDI Bridge to exchange B2B messages in Windows Azure Service Bus”

  1. Hi Sandro,
    Hope you are doing good.
    Is it possible to create the Trading Partner & Agreements in Azure using Powershell script ?
    Trying to automate, if we have 100s of Trading partners/agreements to create in Azure. Please let me know the possibilities.

Leave a Reply

Your email address will not be published. Required fields are marked *

turbo360

Back to Top