Sunday, December 5, 2010

BizTalk Server Tutorial Part 4: Receive Pipeline

Charan: Hey dude I have another problem. We have replaced the application consuming the simple text file from the destination location (C:\BizTalkServerTutorial\FileDrop\DestinationLocation), the new application expect input as XML whereas first application drop its output at source location(C:\BizTalkServerTutorial\FileDrop\SourceLocation) as a comma delimited text file as shown below:

BMTP2000E,Nitin,Sachdeva,1983-10-06,50000
Fields description-SSNumber,FirstName,LastName,DOB(yyyy-mm-dd),Amount

Rohit:It can be done easily by creating a schema for flat-file(flat-file is a simple text file. It could be delimited as shown above or positional where each filed has a fixed length) and using a custom receive pipeline to convert the flat file into XML.

Steps
First, save the output into a sample text file (C:\BizTalkServerTutorial\FileDrop\App1Output.txt)

BMTP2000E,Nitin,Sachdeva,10/03/1983,50000

Next open the ‘Visual Studio 2010’ and create a BizTalk project with name ‘BizTalkTutorial.Part4’ as shown below:

Right click the ‘BizTalkTutorial.Part4’ and choose ‘Add New Item

Choose ‘Flat File Schema Wizard’ and give ‘LoanRequest.xsd’ as the name of the schema.

Click next on First Screen and specify the information in ‘BizTalk FlatFile Schema Wizard’ as shown below and click Next button.

On Next screen select the data in our case we are having only one row so select it as shown below and click Next button.

Because input file is comma delimited so select ‘By delimiter symbol’ and click Next button.

On next screen select comma(,) as child delimiter for record as each field in record is delimited by comma(,) character and click Next button.

Specify the name of the field and appropriate data type as shown below and click Next button.

Click finish to generate flat-file schema.

Next create a custom receive pipeline
Right-click ‘BizTalkTutorial.Part4’ and choose ‘Add -> New Item…’. Specify the name of receive pipeline as ‘ReceivePipelineForLoanRequest.btp’ and click Add.

Drag ‘Flat file disassembler’ from the toolbox to Disassemble stage and set Document Schema as ‘BizTalkTutorial.Part4.LoanRequest’ as shown below

Right click the ‘BizTalkTutorial.Part4’ and choose properties to open the project properties. Go to Deployment tab and specify Application Name as ‘BizTalkServerTutorial’.

Go to Signing tab and create a new key with name ‘Key.snk’ to Sign the assembly.

Right-click ‘BizTalkTutorial.Part4’ and choose Build after successfully building the solution again right-click ‘BizTalkTutorial.Part4’ and choose Deploy. Your assembly should now be deployed to BizTalk server and GAC.

You can verify the deployed assembly by going to ‘Resources’ in ‘BizTalkServerTutorial’ application.

You can also verify the deployed receive pipeline in ‘Pipelines’.

Now open the properties for the receive location ‘RL_SourceApplication_FILE’ and select the newly deployed receive pipeline.

Test the solution this time you will get output at destination folder in XML format.

Summary
You have seen
    How to create BizTalk project in Visual Studio 2010.
    How to create flat file schema using the Flat File Schema Wizard
    How to create receive pipeline
    How to specify the BizTalk application name for deploying generated assembly
    How to sign the assembly
    How to build and deploy the BizTalk project 
    How to use Flat-File disassembler to covert flat-file to XML.

1 comment:

Anonymous said...

Really helpful

Post a Comment