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 5 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


Testing Universal Services

Testing Universal Services

The Web service is accessed through the supplied test page.

The URL of the test page is http://localhost:8080/UniversalServices/testServices.html, depending on the port number of your Web server.

Figure 46 shows the test page (note that the port number 8888 is used here):


Figure 46. Universal Services test page
Screenshot showing the Universal Services test page

The operation getPrimaryKeys returns a list of all the IDs of rows in the table. These can subsequently be used in the other operations supplied, like delete, update, or query.



Back to top


How to use the query operation

The query operation can be used for practice with XPath expressions, or as a starting point for creating your own dedicated XPath queries. You enter a native XPath expression (in other words, without any DB2-specific keywords) in the text box. The operation then wraps it in the necessary DB2 syntax before it is sent to DB2 for processing. (This makes it easier to focus on the actual XPath expression.)

The Universal Services are for use with any XML schema. This tutorial therefore cannot supply many non-trivial examples that will work in all cases. One that will work is '.', which just returns the context node; that is, the whole XML document. Another is '//text()', which prints all text values in the document.

An example of an XPath expression for a UBL 2.0 Invoice document, which simply selects the whole invoice, is shown in Listing 3:


Listing 3. XPath expression UBL 2.0 Invoice

declare default element namespace
 "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2";
  /Invoice

For further information about and for the syntax of XPath, refer to the tutorial "Get Started with XPath" (developerWorks, May 2004).



Back to top


Industry Bundles

If you are interested in a specific XML format, or if you just need some data for test purposes that have the quality of real-life data, you may want to take a look at the Industry Bundles that are available for download (see Resources > "Industry Formats and Services with pureXML").

There are Industry Bundles for a number of different XML formats, such as UNIFI, UBL 2.0, IRS1120, and more.

The bundles contain DDL for a table that matches the one this tutorial uses for Universal Services. They also contain the XML schemas that document the XML format and some sample XML documents adhering to this schema. These can be used with Universal Services to test the application.



Back to top



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