This article provides detailed explanation required to create a BizTalk application to send X-12 4010-850 Purchase Order from one trading partner to an XML Purchase Order for another trading partner.
For this, we need the following adapters:
· Base EDI Adapter at the receive port
· FILE Adapter at the send port
To start with, there are 5 major steps involved.
· Creating the BizTalk application
· Create trading partners
· Configuring the ports
· Associating the trading partner with the send port
· Testing the application
Creating the BizTalk Application
Open Microsoft Visual Studio 2005. Select File->New->Projects. From the Project Types: select BizTalk projects and from the right pane select Empty BizTalk Project. Provide a folder location(C :/) for the project and specify a name for the project (UsingDb2Adapter) and click OK. We have to develop 5 artifacts:
· 4010-850 Purchase order schema
· Flat File Schema
· Map
· Orchestration
There are two trading partners with differing methods of formatting documents electronically, yet who need to electronically exchange data. The EDI adapter acts as a translator for interchanges between the two companies. In this module, Company A initiates an interchange by sending a document in the X-12 document format to Company B. The Base EDI adapter receives the EDI document, and translates it into an XML representation of itself. The XML document is then sent to Company B.
EDI document used
|
Document |
Doc # |
Standard |
Version |
|
Purchase Order |
850 |
X12-VICS |
004010 |
List of Used Segments

Elements to Map
Creating 4010-850 Purchase order schema
Right click on the newly created project and select Add->Add Existing Item. In the dialog box that appears, open 850Schema.xsd from default BizTalk installation folder location. (C:\Program Files\Microsoft BizTalk Server 2006\EDI\Adapter\EDI Schemas\X12\4010)

The 850Schema.xsd schema when generated will look like this.

Creating Flat File Schema
Right click on the project name and select Add->New Item. In the dialog box that appears, select Schema from the left pane and Flat file schema from the templates and specify the name and give add.

Identify the fields that will be expected by Company B in an XML format and generate a schema relevant to Company B’s requirement.
The Flat file schema is generated as follows.

Creating Map
Right click on project name and select Add->New Item. Select Map and provide suitable name.

In the Open Source Schema, select the 850Schema.xsd schema that we created. In the destination schema, select flat file schema and select request root from the option provided.
Now, a mapping is performed based on the “Elements to Map” table stated earlier, that will map the X-12 Schema PO nodes to the custom schema developed for Company B.

Creating Orchestration
Right click on project name and select Add->New Item. Select Orchestration and provide suitable name.
In the Orchestration view, create two messages with the following specifications
Message_1
· Identifier: 850_Msg
· Message Type: Schemas-> 850Schema
Message_2
· Identifier: XML_Msg
· Message Type: Schemas->Flat file Schema
In the Orchestration view, create two port types with the following specifications
PortType_1
· Identifier: 850_Rcv_PortType
· Message Type: 850Schema
PortType_2
· Identifier: XML_Snd_PortType
· Message Type: Flat file Schema
In the Orchestration Design Window, drag and drop the following shapes and set the specific properties.
Port_1
· Name:850_Rcv_Port
· Port Type: 850_Rcv_PortType
· Port Direction: Receive
· Port Binding: Specify later
Port_1
· Name: XML_Snd_Port
· Port Type: XML_Snd_PortType
· Port Direction: Send
· Port Binding: Specify later
Receive
· Message: 850_Msg
· Operation: 850_Rcv_Port.Operation_1.Request
Construct Message
· Message Constructed: XML_Msg
Transform
Click Ellipses from the Input Messages property and from the Transform Configuration dialog box that appears, select Existing map. From Source select 850_Msg and for Destination, select XML_Msg.
Send
· Message: XML_Msg
· Operation: XML_Snd_Port.Operation_1.Request
Save the application. Generate a strong name key. Build and deploy the application.

Configuring the ports
Open BizTalk Administration Console. Expand the nodes and arrive at the newly created application. The orchestration appears in the admin console. Now we need to create parties, Send and receive ports.
Creating Parties
Add a new party called CompanyA
1. Right-click the Parties folder and select Add party.
2. Type CompanyA in the Name field, that is at the top of the dialog box.
3. For the Party Alias values, type EDI in the name field, by clicking on the row with the * symbol.
4. Enter EDI in the Qualifier field.
5. Enter EDI: //7654321:ZZ:7654321 in the Value field.
6. Click OK to finish.

CompanyA will initiate the document interchange by sending an EDI message to CompanyB.
To add a new party called CompanyB
1. Right-click the Parties folder and select Add party.
2. Type CompanyB in the Name field that is at the top of the dialog box.
3. For the Party Alias values, type EDI in the name field by clicking on the row with the * symbol.
4. Type EDI in the Qualifier field.
5. Type EDI: //1234567:ZZ:1234567 in the Value field.
6. Click OK to finish.

Creating Receive Port
To create a new receive port
1. Click the Receive Ports folder, right-click, and click the Add Receive Port.
2. Select a one-way port from the drop-down list.
3. Type EDIfromCompanyA in the Name field.
4. Click the OK button to continue.
The receive port has now been created. You will now create a receive location for this receive port.
To create a new receive location
1. Expand the EDIfromCompanyA Receive Port tree view, then right-click the Receive Locations folder and click Add Receive Location.
2. In the Name field, type PickupEDIfromCompanyA.
3. In the Transport field, select EDI from the drop- down list.
4. Select the Address (URI) field and click the ellipsis (…) button.
The EDI properties screen appears.
To configure the EDI transport properties
1. Expand the Adapter Properties tree view. In the Logical Address folder, click the ellipsis (...) button.
2. Select CompanyA, which has a URI value of EDI://7654321:ZZ:7654321.
3. Expand the Supported Document Types for X-12 and expand the 4010 category. In the 850 field, select the 4010 envelope from the drop-down list.
4. Click OK to continue.
To complete configuration of the receive location
1. Click the Receive Handler field and select BizTalkServerApplication from the drop-down list.
2. Click the Receive Pipelines field and select XmlReceive from the drop-down list.
3. Click OK to finish.
Creating Send Port
To create a send port called XMLToCompanyB
1. Right-click the Send Ports folder and select Add Send Port, select a Static one-way Port from the drop-down list.
2. In the Name field, type XMLToCompanyB.
3. In the Transport Type field, select FILE from the drop-down list.
4. Select the Address (URI) field and click the ellipsis (…) button.
The File Transport properties page appears.
To configure FILE transport properties
1. In the Destination folder field, navigate to the destination folder to drop the output file.
2. Leave the default options for the filename and copy mode fields.
3. Click OK.
To configure the send pipeline value
You now specify a send pipeline for this port.
1. Click the Send folder.
2. Expand the Send Pipeline property, click the send pipeline field and select XMLTransmit from the drop-down list.
3. Click the OK to finish.
Associate a party to a send port
1. Click the Parties Folder in BizTalk Explorer.
2. Right-click CompanyB and select Edit.
3. Click the Send Ports tab and select XMLToCompanyB from the drop-down list.
4. Click OK to finish.
Configure the Base EDI Adapter
1. From the Start menu, click Programs, and then click Microsoft BizTalk Server 2004, then BizTalk Server Administration.
2. Expand the Microsoft BizTalk Server 2004 tree view.
3. Click the Adapters folder; then double-click EDI.
The Base EDI adapter contains a predefined send handler and receive handler.
To configure the BizTalk Server send handler
1. Double-click the Send Handlers folder.
2. Double-click the predefined host to open the Properties dialog box.
3. Click the Properties tab. Click the ellipsis (...) button in the Logical Address field.
4. Select the party CompanyB with the URI EDI://1234567:ZZ:1234567. The URI acts as an identifier for CompanyB; it is the code by which it is known in the EDI world. This identification is used within the EDI documents themselves.
5. Expand the Connection properties. Type 11010 in the Port field. This is the port number through which documents will be sent to the Base EDI adapter.
6. Click OK to finish.
To configure the BizTalk Server receive handler
1. Double-click the Receive Handlers folder
2. Double-click the host to open the Properties dialog box.
3. Expand Connector Properties, File System, Account, Folder (full path or UNC) fields and set it to a receive location.
4. Expand the Connection Properties section. In the Port field, type 11011. This is the port that BizTalk Server 2004 listens to, in order to receive messages from the Base EDI adapter.
5. Click OK to finish.
Testing the Application
Once the application and Host instances are started, drop the input file in the receive location. The file will be picked up from that location and dropped in the output location.
Sample Input EDI
ISA*00* *00* *ZZ*7654321 *ZZ*1234567 *991221*1226*U*00401*000000025*0*T*>
GS*PO*7654321*1234567*19991221*1226*1*X*004010
ST*850*0001
BEG*00*NE*3859199838**19950727***IBM
PER*AA*Andrew Carlson*TE*(708) 555-2930
DTM*002*19970523
PO1*1*93*BX*145.39**CB*KOW-20392-10
PID*F****Uninterruptible Power System
PER*AA*Camilla Anderson*TE*(708) 555-2011
PO1*2*25*EA*35.68**CB*1093-4927-001
PID*F****High Volume Printer Stand
PER*AA*Miranda Cappelan*TE*(708) 555-1111
PO1*3*4*PC*2002.91**CB*ABX-2001
PID*F****Electronics Cabinet Package (56" High)
CTT*3
SE*14*0001
GE*1*1
IEA*1*000000025
Sample Output XML
<? Xml version="1.0" encoding="utf-8”?>
<NorthwindReq>
<Header reqNumber="3859199838" reqStatus="New" dateCreated="1995-07-27" timeCreated="16:41:52" />
<Shipping name="Andrew Carlson" addr1="N.A." addr2="N.A." city="N.A." state="N.A." zip="N.A." country="N.A." phone="(708) 555-2930" />
<Items count="3" />
</NorthwindReq>
|