ECS/XML Processor - Outbound Application Integration
ECS/integrated email and the ECS/XML Processor can be integrated to any AS/400 based Business Application with the use of XML Mapping programs. The creation of XML Documents containing data derived from AS/400 based Business Applications requires the development of Generators, to map the data from the business application database to the ECS/XML Transaction and control files (IEXC & IEXT).
The development of XML Mapping programs is a technical task. Before commencing development please ensure that you have the necessary AS/400 authority to create the required objects and that you are technically able. Developing XML Mapping definitions requires a good understanding of the AS/400, DB/400, PDM, RPG, Query, some knowledge of XML and the Business Application you are extracting data from.
The ECS/XML Processor is responsible for performing the following actions for Outbound transactions:
Read through the ECS/XML Control file selecting transactions ready for Generating to XML Documents.
Linking the Transaction Control record to retrieve the XML Event definition.
Build the XML Document, in three stages;
Header Text
Body Text
Footer Text
Parse (validate) the Outbound XML Document and report any errors to the Event Administrator.
Translate data values according to the predefined Element Translations configured for the XML Event.
Copy the Outbound XML Document to the Output Folder defined within the XML Event.
The ECS/XML Processor expects the Transaction and Control records to have been created by an external user developed Generation program. The Generation program is closely linked to the Business Application and should be designed/developed according to the Business Application & XML Document requirements.
The Generator
The XML Generation program is an Outbound mapping program that is responsible for extracting the required details from the Business Application to create the ECS/XML Transaction and Control records. A Generator is executed once for every XML Document required. The Generator is called by the Selector.
The Generator should be designed and developed to perform the following
Use Unique Business Application Transaction reference, passed to the Generator by the Selector, to retrieve required data from the Business Application
Map the required data contents from the Business Application database to the ECS/XML Transaction detail file (IEXT).
Write an ECS/XML Control record to indicate the data has been mapped.
Update the Business Application system to indicate that the data has been mapped.
The Selector
The role of the Selection program is required for the creation of Outbound XML Documents. The Selector is responsible for reading through the Business Application Header file, selecting unprocessed records for which Outbound XML Documents should be created for.
A Selector is normally linked to a business transaction (such as Purchase Orders). A Selector is responsible for executing the relevant Generation Programs passing to it the Unique Transaction Id as a Parameter.
A Selector can be designed to execute multiple Generators, if for example, multiple XML Document formats must be supported for the same business transaction.
Developing Generators
The structure of a typical XML document can be broken down into three primary sections, Header, Body and Footer. The Header and Footer sections normally contains static information which rarely varies between individual transactions. The Body section normally contains more volatile information relating to the individual business transaction.
The XML Header and Footer sections can be configured within ECS/integrated email as optional configuration to assist in the development of Outbound mapping programs. This aids development by allowing the configuration of the static information within ECS/integrating email, meaning that the Business Application based mapping program need only map the Body section of the XML Document.
The following example demonstrates how this principle works with a sample XML Order:
<?xml
version ="1.0"?>
<!-- ECS/XML -->
<Document>
<header>
<delivery>
<message>
<messageID>XML_Order</messageID>
<sent>2002-02-20T18:22:51+01:00</sent>
<subject>XML Sample Order</subject>
</message>
<to>
<address>customer.services@xyz.com</address>
</to>
<from>
<address>purchasing@ecs-europe.com</address>
</from>
</delivery>
</header>
<body>
<Order>
<OrderHead>
<OrderType>Purchase Order</OrderType>
<OrderCurrency>
<Currency Code="EUR">Euro</Currency>
</OrderCurrency>
</OrderHead>
<OrderReferences>
<BuyersOrderNumber>181853</BuyersOrderNumber>
</OrderReferences>
<OrderDate>2002-02-20</OrderDate>
<Supplier>
<Party>XYZ Supplies Ltd</Party>
<Address>
<AddressLine>Alphabet House</AddressLine>
<AddressLine>1 The Loop</AddressLine>
<City>Birmingham</City>
<State>Midlands</State>
<PostCode>B19 1DS</PostCode>
</Address>
</Supplier>
<Buyer>
<Party>ECS Limited</Party>
<Address>
<AddressLine>Commerce House</AddressLine>
<AddressLine>London Road</AddressLine>
<City>Horsham</City>
<State>West Sussex</State>
<PostCode>RH13 9WJ</PostCode>
</Address>
</Buyer>
<OrderLine>
<LineNumber>1</LineNumber>
<Quantity>
<Amount>3</Amount>
</Quantity>
<Product>
<ItemCode>PEN</ItemCode>
</Product>
</OrderLine>
<OrderLine>
<LineNumber>2</LineNumber>
<Quantity>
<Amount>6</Amount>
</Quantity>
<Product>
<ItemCode>INK</ItemCode>
</Product>
</OrderLine>
</Order>
</body>
</Document>
The RED section represents the Header text which can be configured within the XML Event Header Maintenance.
The BLUE section represents the XML Document Body text which is generated by a user developed Business Application specific mapping program. .
The GREEN section represents the Footer text which can be configured within the XML Event Footer Maintenance.
The configuration of XML Event Header and Footer is optional. This information can be written with the same user developed Business Application Mapping program that writes the Body text, if preferred.
The Header and Footer can contain specific volatile information, such as Date, Time and retrieve certain key values from the ECS/XML Processor Control file. The insertion of these values is controlled by using special values which will be automatically replaced by the ECS/XML Processor when the XML document is generated. See the section on maintaining Header and Footer Text for more information.
Each Generator should be designed to only map the required "Body" section of the XML Document. It is important when designing Generation programs that the mapped section must originate from a single root. In the example shown above the entire Blue section is wrapped within the "Order" Label. Note that <Order> is the first element within the Body Section and </Order> is the last element label within the Body section.
The point of application integration with the ECS/XML Processor is with two DB/400 physical files:
IEXC - ECS/XML Transaction Control
IEXT - ECS/XML Transaction Detail file
User defined mapping programs, shown in the following diagram in yellow, are required to integrate the ECS/XML Processor Transaction and Control Files with your Business Application System:
The Generation program must write one record to the ECS/XML Transaction file for each data element required in the Outbound XML Document. The Element Labels and Tree structure of the XML Document must also be written to the Transaction file:
The following defines the mapping requirements for Outbound XML Documents:
File: IEXT, ECS/XML Transaction detail file - Map one record for every data value.
Field | Description | Required | Comments |
XTGUI | Global Unique Id | M | Unique Transaction Id which links IEXT & IEXC |
XTSEQ | Sequence | M | Sequential Sequence number |
XTVAL | Element Value | M | Element Data Value |
XTATT | Attribute Label | O | Attribute Label only required if element requires an Attribute |
XTATT2 | Attribute Label | O | 2nd Attribute Label |
XTATT3 | Attribute Label | O | 3rd Attribute Label |
XTATT4 | Attribute Label | O | 4th Attribute Label |
XTATT5 | Attribute Label | O | 5th Attribute Label |
XTATV | Attribute Value | O | 1st Attribute Value |
XTATV2 | Attribute Value | O | 2nd Attribute Value |
XTATV3 | Attribute Value | O | 3rd Attribute Value |
XTATV4 | Attribute Value | O | 4th Attribute Value |
XTATV5 | Attribute Value | O | 5th Attribute Valuer |
XTTYP | Element Type | M | Element Type (V=Element Value, A=Attribute Value) |
XTEL01 | Element Node Label | M | 1st Level Element Label |
XTEL02 | Element Node Label | O | 2nd Level Element Label |
XTEL03 | Element Node Label | O | 3rd Level Element Label |
XTEL04 | Element Node Label | O | 4th Level Element Label |
XTEL05 | Element Node Label | O | 5th Level Element Label |
XTEL06 | Element Node Label | O | 6th Level Element Label |
XTEL07 | Element Node Label | O | 7th Level Element Label |
XTEL08 | Element Node Label | O | 8th Level Element Label |
XTEL09 | Element Node Label | O | 9th Level Element Label |
XTEL10 | Element Node Level | O | 10th Level Element Label |
XTEL11 | Element Node Level | O | 11th Level Element Label |
XTEL12 | Element Node Level | O | 12th Level Element Label |
XTEL13 | Element Node Level | O | 13th Level Element Label |
XTEL14 | Element Node Level | O | 14th Level Element Label |
XTEL15 | Element Node Level | O | 15th Level Element Label |
XTEL16 | Element Node Level | O | 16th Level Element Label |
XTEL17 | Element Node Level | O | 17th Level Element Label |
XTEL18 | Element Node Level | O | 18th Level Element Label |
XTEL19 | Element Node Level | O | 19th Level Element Label |
XTEL20 | Element Node Level | O | 20th Level Element Label |
XTLMU | Last Maintained User | M | Generation Program Name |
XTLMD | Last Maintained Date | M | Mapped Date (YYYYMMDD) |
XTLMT | Last Maintained Time | M | Mapped Time (HHMMSS) |
Required: M=Mandatory, O=Optional
File: IEXC, ECS/XML Control file - Map one record for every XML Document required.
Field | Description | Required | Comments |
XCGUI | Global Unique Id | M | Unique Transaction Id which links IEXT & IEXC, this can be the Transaction reference number or a calculated value. |
XCDIR | Direction (I/O) | M | O=Outbound |
XCEVT | Event Id | M | Relevant XML Event Id as held in IEXE.XEEVT |
XCSTS | Status | M | "RDY" |
XCTP | Trading Partner | O | Optional, will be automatically extracted from XML Event if not specified |
XCTRAN | Transport Method | O | Optional, will be automatically extracted from XML Event if not specified |
XCSID | Sender Id | O | Optional, will be automatically extracted from XML Event if not specified |
XCRID | Receiver Id | O | Optional, will be automatically extracted from XML Event if not specified |
XCTRIP | Trigger Pgm Override | O | Optional, will be automatically extracted from XML Event if not specified |
XCTRIL | Trigger Lib Override | O | Optional, will be automatically extracted from XML Event if not specified |
XCETRP | Error Pgm Override | O | Optional, will be automatically extracted from XML Event if not specified |
XCETRL | Error Lib Override | O | Optional, will be automatically extracted from XML Event if not specified |
XCIPTH | XML Input Path | O | Not Required for Outbound Transactions |
XCOPTH | XML Output Path | O | Optional, will be automatically extracted from XML Event if not specified |
XCXFIL | XML File name | O | Not Required, contains name of Output XML File. |
XCOFIL | XML Output File Name Override | O | Optional file name override. Automatic file name will be generated if a value is not specified. |
XCOGUI | Original GUID (XCGUI) | O | This will contain the value from XCGUI once when processed by ECS/XML. |
XCAREF | Application Reference | O | Map Transaction Reference (ie Order/Invoice No) |
XCERR | Error Description | O | Not Required. |
XCLMU | Last Maintained User | M | Generation Program Name |
XCLMD | Last Maintained Date | M | Current Date (YYYYMMDD) |
XCLMT | Last Maintained Time | M | Current Time (HHMMSS) |
Required: M=Mandatory, O=Optional
For Example the following represents a section of a sample XML Order, this section contains two element values and one Attribute Value; "Purchase Order", "EUR" and "Euro" :
<Order>
<OrderHead>
<OrderType>Purchase Order</OrderType>
<OrderCurrency>
<Currency Code="EUR">Euro</Currency>
</OrderCurrency>
</OrderHead>
The example section only actually represents two elements containing data.
An example of the ECS/XML Transaction and Control records required to create the section of XML Document shown would look like:
File: IEXT, ECS/XML Transaction detail file - Record 1
Field | Description | Value |
XTGUI | Global Unique Id | 20001231125959001 |
XTSEQ | Sequence | 001 |
XTVAL | Element Value | Purchase Order |
XTTYP | Element Type | V |
XTEL01 | Element Node Label | Order |
XTEL02 | Element Node Label | OrderHead |
XTEL03 | Element Node Label | OrderType |
XTLMU | Last Maintained User | X501 |
XTLMD | Last Maintained Date | 20001231 |
XTLMT | Last Maintained Time | 125959 |
File: IEXT, Record 2
Field | Description | Value |
XTGUI | Global Unique Id | 20001231125959001 |
XTSEQ | Sequence | 002 |
XTVAL | Element Value | Euro |
XTATT | Attribute Label | Code |
XTATV | Attribute Value | EUR |
XTTYP | Element Type | A |
XTEL01 | Element Node Label | Order |
XTEL02 | Element Node Label | OrderHead |
XTEL03 | Element Node Label | OrderCurrency |
XTEL04 | Element Node Label | Currency |
XTLMU | Last Maintained User | X501 |
XTLMD | Last Maintained Date | 20001231 |
XTLMT | Last Maintained Time | 125959 |
File: IEXC, ECS/XML Control file - Map one record for every XML Document required.
Field | Description | Value |
XCGUI | Global Unique Id | 20001231125959001 |
XCDIR | Direction (I/O) | O=Outbound |
XCEVT | Event Id | XYZ_ORD_OUT |
XCSTS | Status | "RDY" |
XCAREF | Application Reference | "Purchase Order Number 22545" |
XCLMU | Last Maintained User | X501 |
XCLMD | Last Maintained Date | 20001231 |
XCLMT | Last Maintained Time | 125959 |
Support for Elements with Blank Values
The ECS/XML Processor
will ignore records where the fields IEXT.XTVAL, XTATV, XTATV2, XTATV3, XTATV4
and XTATV5 all contain blanks. If you have a requirement to write an XML Element
with a Blank value then special value &BLANK can be used in IEXT.XTVAL. The
&BLANK will be automatically replaced with a blank space by the XML
Processor.
Forcing the occurrence of a new Group
There are times when you may need to force the end of a Group and the start of a new identical Group. The ECS/XML Processor will detect new Groups and automatically insert the end tags and start tags unless the Groups have exactly the same Tags. Following Example demonstrates where this may be used:
<REFERENCE REFTYPE="CUR">
<REFDESC>Customers Reference Number</REFDESC>
<REFCODE>112288785</REFCODE>
</REFERENCE>
<REFERENCE REFTYPE="CON">
<REFDESC>Contact</REFDESC>
<REFCODE>Fred Smith</REFCODE>
</REFERENCE>
The REFERENCE Element Group is defined twice, but in normal circumstances the ECS/XML Processor will attempt to logically group all the elements contained within both REFERENCE elements into one single group, which in this instance would be logically incorrect. The following record definitions demonstrates how the XML Transaction file (IEXT) should be populated to result in the creation of these XML statements and more importantly how the instruction to force a new Group is defined:
File: IEXT, ECS/XML Transaction detail file - Record 1
Field | Description | Value |
XTGUI | Global Unique Id | 20001231125959001 |
XTSEQ | Sequence | 001 |
XTVAL | Element Value | |
XTTYP | Element Type | A |
XTATT | Attribute Label | REFTYPE |
XTATV | Attribute Value | CUR |
XTEL01 | Element Node Label | Order |
XTEL02 | Element Node Label | REFERENCE |
File: IEXT, Record 2
Field | Description | Value |
XTGUI | Global Unique Id | 20001231125959001 |
XTSEQ | Sequence | 002 |
XTVAL | Element Value | Customers Reference Number |
XTTYP | Element Type | V |
XTEL01 | Element Node Label | Order |
XTEL02 | Element Node Label | REFERENCE |
XTEL03 | Element Node Label | REFDESC |
File: IEXT, Record 3
Field | Description | Value |
XTGUI | Global Unique Id | 20001231125959001 |
XTSEQ | Sequence | 003 |
XTVAL | Element Value | 112288785 |
XTTYP | Element Type | V |
XTEL01 | Element Node Label | Order |
XTEL02 | Element Node Label | REFERENCE |
XTEL03 | Element Node Label | REFCODE |
File: IEXT, Record 4
Field | Description | Value |
XTGUI | Global Unique Id | 20001231125959001 |
XTSEQ | Sequence | 004 |
XTVAL | Element Value | &BLANK |
XTTYP | Element Type | V |
XTEL01 | Element Node Label | Order |
File: IEXT, Record 5
Field | Description | Value |
XTGUI | Global Unique Id | 20001231125959001 |
XTSEQ | Sequence | 005 |
XTVAL | Element Value | |
XTTYP | Element Type | A |
XTATT | Attribute Label | REFTYPE |
XTATV | Attribute Value | CUR |
XTEL01 | Element Node Label | Order |
XTEL02 | Element Node Label | REFERENCE |
File: IEXT, Record 6
Field | Description | Value |
XTGUI | Global Unique Id | 20001231125959001 |
XTSEQ | Sequence | 006 |
XTVAL | Element Value | Customers Reference Number |
XTTYP | Element Type | V |
XTEL01 | Element Node Label | Order |
XTEL02 | Element Node Label | REFERENCE |
XTEL03 | Element Node Label | REFDESC |
File: IEXT, Record 7
Field | Description | Value |
XTGUI | Global Unique Id | 20001231125959001 |
XTSEQ | Sequence | 007 |
XTVAL | Element Value | 112288785 |
XTTYP | Element Type | V |
XTEL01 | Element Node Label | Order |
XTEL02 | Element Node Label | REFERENCE |
XTEL03 | Element Node Label | REFCODE |
In this example, the fourth record is responsible for forcing the closure of the first group and the occurrence of the second group. This blank record resets the XML Processor back to the previous element group (Order). The special value &BLANK is used because a value is not required to be written to this element.
This same logic should also be implemented for writing multiple detail records, such as Order Lines or Address information.
ECS/XML Processor Sample Application
ECS/integrated email is supplied with a sample XML integration environment with programs and documented source code demonstrating how Generation programs are built, these can be used as templates and adapted to suit the requirements of your XML Documents and Business Application.
Click here for more information on using the XML Sample Application and Mapping Programs.
ECS/XML Outbound Processing limits and capabilities:
Maximum number of element levels within the Body section of an Outbound XML Document is 20.
Maximum number of Attributes and Attribute values per Element is 5.
<<<<< Back to ECS/XML Menu <<<<<
Copyright © 1998-2003 Electronic Commerce Solutions All rights reserved.
ECS/integrated email & ECS/ie are trademarks of Electronic Commerce Solutions, Ltd. Other brand names and product names used in this document are the trademarks and trade names of their respective holders and may be registered.