Showing posts with label EDI. Show all posts
Showing posts with label EDI. Show all posts

Thursday, 30 January 2014

Using Windows Azure Biztalk Service to receive EDI file from multiple partner



Introduction

This sample demonstrates how to use Windows Azure Biztalk Service (WABS) to receive EDI file , transform EDI  to XML. The EDI Bridge receives the EDI 832 file, transforms and sends it to Azure Service Bus Queue.
Use Message Receiver to retrieve messages from the Queue.

Business Scenario

Fabrikam, Northridge and Contoso are three business partners. Fabrikam and Northridge (the supplier) sends product catalog messages to Contoso (the retailer) in EDI format. Contoso maintains all the product catalog data in xml format within Contoso’s premises. Fabrikam and Northridge send EDI 832 messages to Contoso. Hence, Contoso has to implement a solution on Windows Azure, which enables the following: Contoso must expose end point from where it receive EDI 832 files from Fabrikam and Northridge
Contoso must process EDI 832, validates and transformed to XML format

To enable this scenario, Contoso does the following:

Create EDI and XML Schema, Mapping between EDI and XML.
Create and configure trading partner setup for Fabrikam, Northridge and Contoso
Create Queue on Azure service bus to store XML.


Step By Step.

Create Biztalk Services Artifacts Project in visual studio 2012.

 
Delete Default Map and Schema (Schema1, Schema2 and Map).
Add EDI 832 schema. (Download MicrosoftEDIxsdTemplate from msdn )
Create xml schema for price sales catalog.

Create Map.

Go to WABS portal and upload schema and Map.


Upload Map













Create 3 partners on the portal

 











Click on Save.
Similarly you can create profile for contoso and fabrikam.
Create agreements between
  • contoso and fabrikam
  • contoso and Northridge

Steps to create agreement between contoso and fabrikam.
Click on Agreements ->New.


Add partner name and Click on continue.
Select the transport type over which contoso want to receive EDI 832.
I am using transport type as HTTP for demo purpose.

















Select Schema in the protocol section  














Select Map in the transport section
Now in the route section set routing settings.













Click on add to add routing actions
















Set Service bus namespace, Issuer Name, Issuer Key and Queue Name.

 












Similarly do the send setting.
 












In Similar way we can create agreement for contoso and Northridge
After created two agreements, you can check 4 bridges deployed on portal 















Agreement/1/Receive – to receive EDI from fabrikam
Agreement/2/Receive – to receive EDI from Northridge
Agreement/1/Send-to sends EDI from contoso
Agreement/2/Send- to send EDI from contoso

Test the solution.

Download Biztalk Service Explorer.














Connect to your Biztalk services.
Using Biztalk services explorer to send EDI message to EDI bridges.














After send EDI message to bridge, you can check in tracking whether message is routed to success Queue or Error Queue.

 












if message is routed to success queue, then you can download XML from SuccessQueue
Read Message From SuccessQueue Queue.
Set the ConnectionString and Run MessagingWithQueue Sample, Download 

< add key="Microsoft.ServiceBus.ConnectionString" value="<ConnectionString Copy from portal>" />


Source Code


Download Source code from Here

Wednesday, 27 February 2013

EDI Batching using Biztalk Server 2010



This document describes how to batch multiple EDI document into single interchange EDI.

EDI Batching in Biztalk is done using Batching orchestration(Microsoft.BizTalk.Edi.BatchingOrchestration.BatchingService) that is shipped with Biztalk. This batching orchestration is directly binded with MessageBox and picks up message with EDI.ToBeBatched=True. This flag is set when the message is received using edi receive pipeline. There is a component called "BatchMarker" in the receive pipeline that promotes and sets "EDI.ToBeBatched=True".

 Example of Interchange with multiple EDI 840 Transaction.















1: Create Receive Pipeline “EDIBatchMarkPipeline” which will mark edi document for EDI Batch.
  •  Create receive pipeline
  • Add EDI Disassembler, add Batch Marker component.

2: Create receive port “EDIBatchMarkPortFor840”and receive location with EDIBatchMarkPipeline.
Example of EDI 840 with single transaction for batching.

ISA*00*          *00*          *ZZ*US             *ZZ*THEM           *130227*0057*U*00401*000000020*0*T*:~
GS*RQ*BTS-SENDER*RECEIVE-APP*130227*0057*20*T*00401~
ST*840*0020~
BQT*00*BQT02*20111204*001*20120103~
PER*1A*Firstname1**Lastname1~
N1*01~
N2*C01~
N3*Line11*Line21~
N4*City1*WA*112*US~
PO1**1**1***1~
SE*9*0020~
GE*1*20~
IEA*1*000000020~

3: Create Batch configuration for batching.

4: Create two parties: ThemPartyFor840, UsPartyFor840

5: Create agreement for two parties name Agreement1.

6: Create identifier settings.















7: Create batch configuration for UsPartyFor840à ThemPartyFor840


 













Filter Expression
BTS.ReceivePortName = EDIBatchMarkPortFor840
BTS.MessageType= http://schemas.microsoft.com/BizTalk/EDI/X12/2006#X12_00401_840

8: Click on start batch, after click on start batch, Orchestration (Microsoft.BizTalk.Edi.BatchingOrchestration.BatchingService) Instance is created in admin console.



When you click on start button in batch configuration, an entry has been created in PAM_Control table
NOTE : BatchingService orchestration monitor PAM_Control table using sql adapter, as entry comes into table , instance of orchestration start to pick EDI  message whose EDI.tobeBatched context property is true.


9: Create Send port with Filter Expression:
EDI.ToBeBatched == False And
EDI.BatchName == Batch1

10: Start Receiveport , sendport and batch,

11: drop multiple EDI 840 to receive location, check output location.