DADX Web services

The DADX File wizard, Web Services DADX Group Configuration wizard, and Web Services wizard assist you in creating Web services that access DB2® and XML data stored in DB2.

DB2 XML Extender

DB2 XML Extender consists of a set of stored procedures, user defined types and user defined functions that enable an application programmer to store and retrieve XML data using DB2. XML Extender uses an XML document format called Document Access Definition (DAD) to define the mapping between XML and relational data. XML Extender allows for the storage and retrieval of XML documents using one of two methods: the XML column access method, and the XML collection access method.

The XML column access method stores XML documents intact, stored as tagged data, and can optionally index the documents in side tables. The XML collection access method stores decomposed XML documents as a collection of rows in tables using traditional relational data types.

Document Access Definition (DAD) and Document Access Definition Extension (DADX)

The Document Access Definition (DAD) file is an XML document that provides control over the mapping of XML documents to a DB2 database for both storage and retrieval. The DADX file is an extension of the XML Extender DAD file and includes standard SQL functionality that does not use the XML Extender. DADX enables the creation of Web services that store and retrieve XML documents managed by XML Extender. A DADX file specifies how to create a Web service using a set of operations that are defined by SQL statements, and optionally DAD files.

With DB2 version 8.2 and later there is the possibility to have the database operations that implement the web service statically stored on the application server or to have the client dynamically determine which database operation should be executed. The dynamic execution of database operations by the client is called Dynamic Query service (DQS). For a DQS service the DADX file only contains a DQS tag and no other operations. The WSDL for all DQS services regardless of which database it uses are the same. This service provides a lower level access to databases similar to JDBC and ODBC. The operations of this service are to get metadata, to execute selects, insert, updates and deletes and stored procedures.

Both XML-based and SQL-based operations are controlled by a file called a DADX. The DADX defines the operations that can be performed by the Web service. The DADX file drives the Web services run-time environment, which includes various database management tools and the Web Object Runtime Framework (WORF). The WORF runtime environment provides a simple mapping of XML schema to SQL data types. The DADX file can contain standard SQL statements, such as SELECT, INSERT, UPDATE, DELETE, and CALL statements to query and update a database and call stored procedures. If you want to process SQL statements at runtime, then you must enable the dynamic query service (DQS) that is provided by WORF by using a DADX file that includes only the <DQS/> tag.

For static DADX files the following types of Web service operations are supported:

XML-based operations include:

  • query
  • storage

An XML-based query enables you to compose XML documents from relational data. An XML document is broken down into its component parts and stored in relational tables. A mapping file, called a DAD file, creates the association between the relational data and the XML document structure. The user-defined mapping of SQL data to XML elements and attributes requires DB2 XML Extender.

SQL-based operations include:

  • call stored procedures
  • insert
  • update
  • delete
  • query

SQL-based query allows you to send SQL statements, including stored procedure calls, to DB2 and to return the results with a default tagging. SQL-based operations do not require DB2 XML Extender since there is no user-defined mapping of SQL data to XML elements and attributes. Data is returned using only a simple mapping of SQL data types, using column names as elements.

The DADX file can also contain DB2 XML Extender elements, such as Document Access Definition (DAD) file references, XML collection operations to generate and store XML documents, or user-defined types (UDT), and user-defined functions (UDF). The DAD file defines a mapping between XML and relational data. DB2 XML Extender allows XML documents to be stored intact, and optionally indexed in side tables. DB2 XML Extender does this by using the XML column access method, or as a collection of relational tables by using the XML collection access method.

DADX Web services

The following diagram illustrates the relationship between XML Extender, DAD, and DADX:

  1. The Web service client sends a request to the Web service. For DQS that request would include for example a SELECT statement or a stored procedure call.
  2. At run-time, the DADX run-time environment resolves the name of the DADX group, the DADX file, and any parameters required by the DADX file. The DADX group contains connection (JDBC and JNDI) and other information that is shared between DADX files within the group.
  3. If the DADX file contains a reference to a DAD file, the DAD file is loaded by the DADX run-time environment. The DAD file specifies the mapping of the XML request to the database.
  4. The DADX run-time environment locates the DADX group and DADX file, then sends the request to the database. XML Extender enables the storage and retrieval of XML data using DB2. For static DADX files the SQL request is found in the DADX and for DQS the request was determined by the client.
  5. The DADX run-time environment then returns the result as an XML document using the HTTP GET, or HTTP POST, or SOAP protocol.

Figure 1. Relationship between XML Extender, DAD, and DADX.

Figure 1 represents the relationship between XML Extender, DAD, and DADX.


Feedback