Generate DADX files

 

The DADX wizard supports the creation of a DADX file from a combination of one or more SQL statements, stored procedures, and DAD files. A DADX file is an XML file that is used to create a Web service that accesses a relational database.

If you are generating a DADX file from an SQL statement that contains parameters, the parameters must be in simple column expressions in order for a parameter type to be properly generated in the DADX file. If you have parameters in complex column expressions (for example, in a function) you have to add them manually to the generated DADX code yourself. This is a known problem.

A Document Access Definition (DAD) file is a user-specified file that provides control over the mapping of XML document elements to DB2 database columns for storage and retrieval. The DADX wizard supports only Xcollection DAD. The types of mappings and operations supported by the DADX wizard are as follows:

If the DAD file that you select defines a SQL statement (SQL_stmt) mapping, you may need to customize the SQL_override information to specify the parameters you want to override from the SQL host variables.

Your SQL statement or stored procedure must exist in the Workbench for you to be able to complete the DADX wizard. For more information on creating SQL statements or stored procedures, refer to the related tasks.

To generate a DADX file:

  1. Click File > New > Other.

  2. In the New window, expand the Web Services node, click DADX File, and then click Next.

  3. (Optional) Expand the folders and select the SQL statements and stored procedures to include in the DADX file. You can select only SQL statements, only stored procedures, or both SQL statements and stored procedures.

  4. Click Next

  5. (Optional) Use this page to select one or more DAD files to include in your DADX file:

    1. To import a DAD file from your file system, click Import Files.

    2. In the Workbench Files list, click a DAD file, and then click >. Repeat this step to add more DAD files.

    3. To remove one or more DAD files from the Selected Files list, click the < or << button.

    4. After you have added all of the DAD files required to the list, Selected Files, click Next

    Note: You must create or import your DADX files into your DADX group: WebProject\JavaSource\groups\DADXGroup. Any relevant DAD files also need to be in this folder. At run time, this is where these files are expected to be located. If this is not true, you may experience database or server errors.

  6. (Optional) Modify or add text to the Operation or Description fields by selecting the row, then selecting the cell that you want to modify. Type your changes, and then press Enter. The Operation field provides a name for the name attribute of the operation tag in the generated DADX file and the Description field provides a description text for the document tag.

  7. Type a file name for your DADX file. It must have the extension .dadx.

  8. (Optional) Enter a description of the DADX file in the Description text field.

  9. Select the Output folder, and then click Finish. For your Web service to function properly, create your DADX file in your DADX group in order . If necessary, you can generate it elsewhere and move it to your DADX group later; however, we recommend that you place it in your DADX group when you first generate it.

The DADX file is generated and opens in the XML editor where you can edit it, as necessary. For more information on using DADX files with Web services, refer to the related tasks below.

Note: For DADX files based on stored procedures, result set metadata is generated for the DADX and used in the call element. Only stored procedures that have result sets with fixed metadata can be invoked from a DADX in order to have a well-defined WSDL file for the Web service.

A <result_set_metadata> element is generated in the DADX for each result set returned by the stored procedure. This is true even if they share the same metadata characteristics. You can modify the generated code to use a single <result_set_metadata> tag if you want. If you modify the metadata name where the metadata is used in a <result_set> child element of a <call> element, make sure that you modify its name in the corresponding <result_set_metadata> definition.

 

Parent topic

Working with SQL statements

 

Related concepts

Create A New SQL Statement wizard
SQL Builder

 

Related tasks

Generating XML from SQL using a wizard