Skip to main content

If you don't have an IBM ID and password, register here.

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. This profile includes the first name, last name, and display name you identified when you registered with developerWorks. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

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

Kirsten A. Larsen (kila@dk.ibm.com), Senior IT specialist, IBM
Kirsten A. Larsen
Kirsten Ann Larsen is a senior IT specialist and technical lead with IT Delivery in IBM Nordics. She has more than 10 years of experience with DB2 for z/OS and has co-authored a Redbook on DB2 security. She has worked with XML since pureXML support was included with the release of DB2 9 in 2007.
Susan Malaika, Senior Technical Staff Member, IBM
Susan Malaika photo
Susan Malaika works in IBM's Information Management Group. She specializes in XML and Web technologies, including Grid computing. She has published articles and co-edited a book on the Web. She is a member of the IBM Academy of Technology.

Summary:  In this tutorial, set up Web access to your pureXML data through simple insert, update, delete, select, and query operations known as the Universal Services. Use the included download bundle with ready-to-install services to explore the concepts of this tutorial, and learn how to quickly build application prototypes with the Universal Services.

View more content in this series

Date:  04 Jun 2009
Level:  Intermediate PDF:  A4 and Letter (3455 KB | 48 pages)Get Adobe® Reader®

Comments:  

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.


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.


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

2 of 10 | Previous | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Information Management, XML, SOA and web services
ArticleID=394485
TutorialTitle=Build a pureXML application in DB2 for z/OS, Part 2: Web enablement through Universal Services
publish-date=06042009
author1-email=kila@dk.ibm.com
author1-email-cc=
author2-email=malaika@us.ibm.com
author2-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).