XMLBindFileService

Introduction

This RDML example of the XMLBindFileService makes use of many of the commands and keywords available within the service.

The XMLBindFileService is very tightly tied to the XML Binding Wizard that comes with LANSA Integrator Studio. Before you start writing the code for your service application you should set up your bindings in the XML Binding Wizard first.

There are two ways that the XML Binding Wizard can handle repeating information in XML documents. One way is to label them as lists, and then use the LIST keyword on the GET and SET commands. Another way is to label them as fragments and use the FRAGMENT keyword on the GET and SET commands. When following the fragment approach, the GET and SET commands need to be placed into loops and run as many times as required for the repeating information.

This example uses Fragments only.

Following are the steps simulating how this service might be used to process some orders:

1.  It uses the LIST command to determine what XML documents are in the inbound orders folder;

2.  The LIST command places the orders into a working list, and using this working list we then use the READ and BIND commands to load and bind each XML document (one by one) to a service created using the XML Binding Wizard. In the READ command, a copy of the file is also archived to another folder;

3.  The GET commands are next used to load the data from the XML documents into locally defined fields. Normally the data from each order would, of course, be uploaded into some existing application database, but for simplicity, this demonstration will just display the order in a screen;

4.  After displaying each order, the CLOSE command is used to close the bind on the current file, and then the DELETE command to removes it from the inbound folders (remember that a copy of it is kept in the archive folder to be read by the READ command.

5.  The next step is to create a response document that will be placed into another folder. This is done using the BIND, SET, and then WRITE commands.

6.  The final step is to use the CLOSE command again to close the bind associated with the creation of the response

7.  Once this step is completed, the process is run through for the next order in the inbound orders folder. The program finishes once the last order is processed.

For this example to work, you will need to do the following steps:

Step 1: XML Binding Wizard

Step 2: Create some folders and some sample XML documents

Step 3: RDML Function Code or the alternative in Step 3. RDMLX Form Code.