BizTalk Training 1 – basic send/receive xml message
BizTalk, Programming, Windows October 30th, 2007Overview
This tutorial shows how to create simple orchestration to send/receive xml messages using FILE Adapter.
There are 9 tutorials in this training.
- BizTalk Training 1 – basic send/receive xml message
- BizTalk Training 2 – receive/send plain text
- BizTalk Training 3 – customize filename dynamically
- BizTalk Training 4 – using Functiods in Map
- BizTalk Training 5 – using FTP Adapter
Objectives
- Learn how to create schema from sample xml file.
- Learn how to send/receive xml message using FILE adapter.
- Learn how to deploy BizTalk project to BizTalk Administration.
Topics
- Add new orchestration.
- Create schema.
- Create new Message.
- Create logical ports.
- Deploy the project.
- Configure BizTalk Administration.
Step-by-step
Suppose that I want BizTalk to process xml message from folder A (C:\FILE1\IN\*.xml) to folder B (C:\FILE1\OUT\%SourceFileName%). The sample data of xml message is in C:\FILE1\person1.xml.
<person> <name>Mr. A</name> <position>Sales Manager</position> <salary>10000</salary> </person>
- Add new orchestration.
- Create schema
- Now I need to create schema for receive and send component. If you don’t have schema file (.xsd file) that corresponds with xml message, you need either to create schema by using wizard to generate from xml message or create by yourself. By using wizard, it’s fast but it doesn’t work well if your xml message is too complex.
- Solution 1: using BizTalk Schema Generator
- To use this wizard, you need to enable it before use once by execute VBScript file that is in BizTalk SDK Utilities directory. If you installed BizTalk on default directory, the files should be in C:\Program Files\Microsoft BizTalk Server 2006\SDK\Utilities\Schema Generator\. If your document type is DTD, execute InstallDTD.vbs. If your document type is standard XML (Well-formed XML), execute InstallWFX.vbs. Or you can execute both files.

- Back to the orchestration, in solution explorer. Select Add Generated Items.

- Select Generate Schemas on left side and select Generate Schemas on right side. Click Add.

- On document type, select Well-Formed XML and select input file from sample xml message. Click OK.

- Wait for a while and you will see your schema has been created.

- You’ll need to clear target namespace because the sample file doesn’t have any target namespace by click on “Schema” and clear Target Namespace in Properties.
- Solution 2: create the schema manually
- In solution explorer, select Add New Items.

- Select Schema Files on left side and select Schema on right side. Also, named the schema as person1.xsd. Click Add.

- Now you’ll see empty schema file. You can add new element by right click on root node -> select Insert Schema Node -> Child Field Element.

- Try to create element as the same in sample xml message. Also, you can change data type in properties window.

- You’ll need to clear target namespace because the sample file doesn’t have any target namespace by click on “Schema” and clear Target Namespace in Properties.
- Change name of the root to Person and now you’ll get the schema for incoming message.
- Create new Message
- On orchestration1, move to Orchestration View. Right click on Messages and select New Message.
- Highlight on Message_1, change Identifier to msgPerson and select Message Type as schema that you’ve created in 5). (Schema -> BizTalkTraining.person1)
- Change Message on receive and send components in the orchestration1 to msgPerson.

- Create logical ports
- You have configured to receive msgPerson and send out msgPerson. Next you need to create logical ports to receive and send these messages from/to.
- Create receive port.
- Right click on Port Surface area (red rectangular) and select New Configured Port.

- Click Next. Named the port as RecvPersonPort. Click Next.

- Configure Port Type.
Name Port Type Name as ‘RecvPersonPortType’. Leave Create a new Port Type, Communication Pattern as One-Way and Access Restrictions as Internal selected. Click Next.
- Configure Port Binding.
- Ensure that “I’ll always be receiving messages on this port.” is selected.
- Select Port binding as “Specify now”.
- Select Transport as “FILE”.
- Type URI: as path with file mask that you want to receive. In this sample, it is “C:\FILE1\IN\*.xml”. That means to read any .xml file in C:\FILE1\IN.
- Select Receive pipeline as XMLReceive.
- Click Next and Finish.
- Right click on Port Surface area (red rectangular) and select New Configured Port.
- Create send port.
- Right click on Port Surface area (red rectangular) and select New Configured Port.

- Click Next. Named the port as SendPersonPort. Click Next.

- Configure Port Type.
Name Port Type Name as ‘SendPersonPortType’. Leave Create a new Port Type, Communication Pattern as One-Way and Access Restrictions as Internal selected. Click Next.

- Configure Port Binding.
- Ensure that “I’ll always be sending messages on this port.” is selected.
- Select Port binding as “Specify now”.
- Select Transport as “FILE”.
- Type URI: as path to destination file that you want to send. In this sample, it is “C:\FILE1\OUT\%SourceFileName%”.
Note: %SourceFileName% is the mask that means using file name as it was receive. - Select Send pipeline as XMLTransmit.
- Click Next and Finish.
- Now you have configured logical ports to map with physical paths. Next is to connect logical ports to receive and send components that you have created previously. Drag green button on RecvPersonPort (1) to green button on Receive_1 component (2). Also, repeat this on send port.

- Deploy the project
- Click on Receive_1 component and change Activate to “True” in the properties.

- We have finished on the orchestration. Next, we are going to deploy the project on BizTalk Administration. On the solution explorer, right click on Solution ‘BizTalkTraining’ and select Properties.

- On Solution Property Pages
- Select Configuration in Configuration Properties.
- Change Configuration to Deployment.
- Ensure that Deploy has been checked.
- Click OK.
- Next create strong name key and assign to the project
- Open Visual Studio 2005 Command Prompt by select on Programs.

- Type in the command prompt ‘sn -k c:\FILE1\BizTalkTraining.snk’. Then the key will be created in c:\FILE1.

- Back to the BizTalkTraining project, right click on BizTalkTraining and select Properties.

- On Property Pages
- Select Assembly in Common Properties.
- Find Assembly Key File. Click … to browse.
- Select file that you have just created “BizTalkTraining.snk”.
- Click Open and OK.
- To change name of the application when deployed, select Deployment in Configuration Properties.
- On Application Name, change to “BizTalkTraining”.
- Click OK.

- Open Visual Studio 2005 Command Prompt by select on Programs.
- Now you’re ready to deploy the project to BizTalk Administration. Right click on Solution ‘BizTalkTraining’ and select Deploy Solution.

- You’ll see in output window if the deploy was succeeded.

- Configure BizTalk Administration
- Open BizTalk Administration; expand BizTalk Server 2006 Administration -> BizTalk Group -> Applications. You’ll see BizTalk Training was deployed to here. Right click on BizTalkTraining and click configure.

- On Configure Application window, select Host to BizTalkServerApplication. Click OK.

- Now you can start your application, but you need to create folder as you have already configured in Visual Studio. For receive folder, C:\FILE1\IN. For send folder, C:\FILE1\OUT.
- Right click BizTalkTraining again; click start to start BizTalk application.

- Click Start again.

- Now BizTalkTraining application is running, you can test your application by copy person1.xml (sample xml file) to receive folder (C:\FILE1\IN). If the application is configured correctly, the file will be moved to send folder (C:\FILE1\OUT) with the same name as in receive folder.
- Result in C:\FILE1\OUT\Person1.xml.

Resources
You can download the example source code (zip file) at here.
The zip file contains
- BizTalkTraining folder which is the example project on Visual Studio 2005.
- FILE1 folder which contains IN and OUT empty sub folders for test receive and send message, BizTalkTraining.snk which is a strong name key file used in the example project and person1.xml which is an example xml message.
- binding.xml file which is a configuration file for import in BizTalk Administration.
Related post
- BizTalk Training 2 – receive/send plain text Overview This tutorial shows how to receive plain text using FILE Adapter and map to xml message while in orchestration...
- BizTalk Training 5 – using FTP Adapter There are 9 tutorials in this topic. Introduction This topic will show how to use FTP Adapter to read and...
- BizTalk Training 3 – customize filename dynamically Overview This tutorial shows how to customize output filename inside orchestration. There are 9 tutorials in this training. BizTalk Training...
- BizTalk Training 4 – using Functiods in Map Introduction This topic will show how to use Functiods in BizTalk. Functiods are like functions, they are objects in Map...
- Biztalk Macros on FILE Send Adapter Microsoft BizTalk server provides a predefined set of macros to help in create output filenames on File send handler. If...
Related posts:










December 7th, 2008 at 7:30 pm
Hi
do you have an example of how to setup MSMQT? i am trying to recieve massages from MSMQ to the orchestra
regards,
Arik
May 2nd, 2009 at 2:59 am
Beautifully explained. I followed the steps and I did not get any error and it works like charm. Thanks for the excellent example.
October 14th, 2009 at 5:33 pm
Hi,
I followed all the steps for developing Orchestration and everything worked fine. I started the application. I copied the person1.xml file from your zip file to c:\FILE1\IN and there is nothing seen in my C:\FILE1\OUT. Please let me know the troubleshooting process so that i can follow that.
October 15th, 2009 at 8:34 am
Hi, Sudha Rajkumar
Is the file on IN folder is gone? Is there any error message? You can check the error message on BizTalk Administration or application event log of Windows.
October 19th, 2009 at 6:55 pm
Hi,
I have got the message in the OUT folder. I have configured it wrongly intially. Now its working finr.
Thanks,
Sudha
March 11th, 2010 at 12:53 pm
Hi,
I followed the steps, and deployed successfully. The project appeared in admin console. But when I started the project, the XML file is not transferring from ‘IN’ folder to ‘OUT’ folder.
What can be the reason. Please help me.
Regards…
March 12th, 2010 at 9:05 am
Hi, Smitha
Does the file in “IN” folder is gone when you put it in there? I suggest you check the Application event log if there is any error.
April 23rd, 2010 at 12:55 pm
Hi
EXCELLENT,BUT PLEASE EXPLAIN EVERY STEP(WHAT WE HAVE TO SELECT THAT ONLY YOU ARE MENTIONING WHY WE WILL USE THAT ONE YOU ARE NOT GIVING EXPLANATION.DO YOU HAVE AN EXAMPLE OF HOW TO SETUP SQL ADAPTER ?
regards,
KOTIREDDY
April 25th, 2010 at 11:09 pm
Hi, kotireddy
Setting up SQL adapter is a bit complex. I was thinking to write one but I was gave up. I recommend you find a book about BizTalk should be better than read on blog post.