Generating 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. The DADX File wizard creates a DADX file in a DADX group of a Web Project.
Prerequisites:
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:
  • SQL statement operations (query and update operations based on SQL statements are supported)
  • RDB_node mapping (storeXML and retrieveXML operations based on DAD file mappings are supported).
  • Stored procedure calls

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. See the http://publib.boulder.ibm.com/infocenter/db2help/index.jsp and look under Developing > Database Applications > Web services and Federated Web Applications for more information.

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. On the DADX Generation page:
    1. Select the Web project and DADX group for the output location of the DADX file. For your Web service to function properly, you must create your DADX file in your DADX group. If necessary, you can generate it elsewhere without using the wizard and move it to your DADX group later; however, we recommend that you place it in your DADX group when you first generate it.
    2. Enter a name for the new DADX file and optionally a description.
    3. Select to create the DADX file using Dynamic Query Services or from a list of SQL queries or stored procedures.
      • If you select to use the Dynamic Query Service click Finish. A DADX file with the <DQS/> operation tag is generated.
      • If you select to create a file from a list of SQL queries or stored procedures click Next.
  4. 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. The SQL statement or stored procedure must exist in the Workbench. Click Next or Finish.
  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 runtime, 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. Click Finish.

The DADX file is generated and opens in the XML editor where you can edit it, as necessary. If you selected to use Dynamic Query Service a db2WebRowSet.xsd file is copied to the WebContent directory.

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.

Once you have created the DADX file, you can create a Web service as described in: Create a DADX Web service.

For additional information about DADX files, refer to the DB2 information center (an online version can be found here: http://publib.boulder.ibm.com/infocenter/db2luw/v9//index.jsp), under Developing > Database applications > Web services and federated Web applications > Creating a Web services provider from a database.


Feedback