Skip to main content

skip to main content

developerWorks  >  Information Management | XML | SOA and Web services  >

Build a pureXML application in DB2 for z/OS, Part 2: Web enablement through Universal Services

developerWorks
Go to the previous pagePage 2 of 11 Go to the next page

Document options
PDF format - Fits A4 and Letter

PDF - Fits A4 and Letter
3455 KB (48 pages)

Get Adobe® Reader®

Discuss

Sample code


My developerWorks needs you!

Connect to your technical community


Rate this tutorial

Help us improve this content


The architecture of Universal Services

The architecture of this small application is three-tier, as shown in Figure 1. At the back end, DB2 for z/OS acts as a database server. The application layer in this case is a Web server running on Windows. The presentation layer or user interface is the Web page itself.

Neither layer is very complex. This tutorial discusses them briefly to give a basic understanding of the different elements and how they work together, although it is not strictly necessary to understand the inner workings of the Web services to set up the Universal Services.

Database layer

In DB2, there is a single table with three columns: ID, which has type INT; COMMENT, which has type VARCHAR; and XMLDATA, which is an XML column. This table is used to store all the XML data for the application, which is just a collection of individual XML documents, each identified by an ID key and with an optional comment field.

There is also a user-defined function that takes an XPath expression and an XML document as input and returns the result of applying this XPath expression to the XML document.



Back to top


Web server

This tutorial uses either WebSphere Application Server, WebSphere Application Server Community Edition, or Tomcat running on Windows (for example, your own laptop) as the Web server. The actual Web service is a set of operations built from simple SQL scripts for select, insert, update, and delete, as well as a script calling the user-defined function defined in DB2 with an XPath expression received through the Web page.

The individual Web service operations are invoked through a Java Servlet, which is supplied together with some necessary libraries.

Together with a few files containing definitions and mappings between different elements, these files comprise the application layer.



Back to top


Presentation layer

The user interface is written in XHTML with XSL stylesheets to format the output from two of the operations of the Web service, namely getXMLDocumentByKey (the select operation) and runxpathXML (the query operation).

Figure 1 illustrates the architecture of Universal Services:


Figure 1. Architecture of Universal Services
Diagram illustrating the architecture of Universal Services                         using boxes, lines, and cylinders

For WebSphere Application Server Community Edition and Tomcat, this tutorial uses the REST protocol, which is really just a fancy way of saying that you send XML over HTTP. For WebSphere Application Server, this tutorial uses SOAP, where (among other things) the messages are wrapped in XML envelopes containing various metadata.

This tutorial accesses DB2 on z/OS from Windows using a JDBC type 4 driver.

The application layer and the presentation layer are packed together in a .war file, which is deployed to the Web server. The .war file is an archive that contains the following:

  • JAR files containing the Java Servlets that interpret the Web service operations and some library classes needed by the servlets
  • WSDL file containing a definition of the Web service (in other words, the operations, their arguments, their protocol binding, and their physical location)
  • XML files containing relationships between the different components: web.xml mapping URLs to servlets, config.xml mapping operations to SQL statements, and other platform-specific XML files
  • XHTML file containing the definition of the Web page
  • XSL files containing stylesheets for formatting the results from two of the five operations of the Web service (the remaining three are so simple, they don't need them)

Figure 2 illustrates the folder structure of the .war file:


Figure 2. .war file structure
Screenshot of the .war file structure


Back to top



Go to the previous pagePage 2 of 11 Go to the next page