Receive messages from DB2 AS/400

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.

 

clip_image002[11]

 

On Usage Reporting Settings page make a selection and click Next.

 

clip_image004[9]

 

On Component Installation screen select at least the components shown below and click Next.

 

clip_image006[9]

 

clip_image008[9]

 

Then click on Install.

 

clip_image010[9]

 

Create Port and Packages

From BizTalk Server Administration console create a new port.

 

clip_image011[9]

 

Specify the typical port properties

 

clip_image013[9]

 

clip_image015[9]

 

clip_image017[9]

 

Select DB2 adapter and click Configure. Build the connection string as first step.

 

clip_image018[9]

 

The wizard starts.

 

clip_image019[9]

 

Select DB2/AS400 as data source platform.

 

clip_image020[9]

 

Specify the AS/400 Network Name o IP address and a port number.

 

clip_image021[9]

 

Specify at least the initial catalog, the package collection and the default schema.

 

clip_image022[9]

 

Choose the international locale settings.

 

clip_image023[9]

 

Then write the credentials.

 

clip_image024[9]

 

To receive data from AS/400 is enough select the following advanced options.

 

clip_image025[9]

 

On the review the connection properties page click Next.

 

clip_image026[9]

 

On the Validation screen click on Packages to generate package on AS/400 library.

 

clip_image027[9]

 

The connection string is composed. Now we have to specify the SQL Command.

 

clip_image028[9]

 

Specify a SQL Command statement.

 

clip_image029[9]

 

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.

 

clip_image030[9]

 

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.

 

clip_image032[9]

 

Choose Add Adapter Metadata.

 

clip_image034[9]

 

Select DB2, then select the port created in the previous step.

 

clip_image035[9]

 

Select the existing connection string.

 

clip_image036[9]

 

Specify the same target namespace and root element name, chosen during port creation.

 

clip_image037[9]

 

Then select the statement type (select statement in my case).

 

clip_image038[9]

 

Specify the select sql script that the receive port will execute.

 

clip_image039[9]

 

Now you have your AS/400 schema

 

clip_image040[9]

 

Second option

From BizTalk Administration console, open the AS/400 receive location properties window an select (temporary) the PassThuReceive pipeline.

 

clip_image042[9]

 

Then create a send port.

 

clip_image044[9]

 

On the Filters tab, specify BTS.ReceivePortName equal to SampleQuery. This allow you to write messages coming from AS/400 in a folder.

 

clip_image046[9]

 

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.

 

clip_image048[9]

 

Select Well-Formed XML and specify the generated file.

 

clip_image049[9]

 

So you have your schema.

 

clip_image051[9]

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s