Well, in a technological age in which everyone is talking about Cloud, Windows Azure and BizTalk Services, it seems strange to talk about AS/400, but at least in Italy there are still many installations and I found few example of its use with BizTalk Server.
This article shows how to implement a simple receiving flow from AS/400 system to a target system. The example shown below reports the steps for installing the necessary components, to apply a basic configuration to a receiving port and to generate the message schema that you will receive from the AS/400.
Additional artifact such as target systems schema messages, maps or orchestration I take them for granted.
Components Setup
From the Microsoft Host Integration Server 2013 cd run setup.
On License Agreement screen select “Yes, I accept the Items…” and click Next.
On Usage Reporting Settings page make a selection and click Next.
On Component Installation screen select at least the components shown below and click Next.
Then click on Install.
Create Port and Packages
From BizTalk Server Administration console create a new port.
Specify the typical port properties
Select DB2 adapter and click Configure. Build the connection string as first step.
The wizard starts.
Select DB2/AS400 as data source platform.
Specify the AS/400 Network Name o IP address and a port number.
Specify at least the initial catalog, the package collection and the default schema.
Choose the international locale settings.
Then write the credentials.
To receive data from AS/400 is enough select the following advanced options.
On the review the connection properties page click Next.
On the Validation screen click on Packages to generate package on AS/400 library.
The connection string is composed. Now we have to specify the SQL Command.
Specify a SQL Command statement.
Note. To write and test SQL statement, typically I use Microsoft SQL Server Management console configuring a linked server to AS/400 system.
Now you have to specify “Document Root Element Name” and “Document Target Namespace” properties.
Generate Schemas
There are two option to generate AS/400 inbound schema:
· Use thewizardfrom Visual Studio(this notalwaysgeneratesa schemethat works)
· Activate the AS/400 receive port and write the output instance on a folder. Then using XML well formed generation schema to import the schema.
First option:
From Visual Studio start Add Generated Items wizard.
Choose Add Adapter Metadata.
Select DB2, then select the port created in the previous step.
Select the existing connection string.
Specify the same target namespace and root element name, chosen during port creation.
Then select the statement type (select statement in my case).
Specify the select sql script that the receive port will execute.
Now you have your AS/400 schema
Second option
From BizTalk Administration console, open the AS/400 receive location properties window an select (temporary) the PassThuReceive pipeline.
Then create a send port.
On the Filters tab, specify BTS.ReceivePortName equal to SampleQuery. This allow you to write messages coming from AS/400 in a folder.
Enable both receive location and send port. In the destination folder you will find an instance of message coming from AS/400 system.
Now, from Visual Studio you can use that instance to generate a schema.
Select Well-Formed XML and specify the generated file.
So you have your schema.