Skip to main content


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

Transform Data Web Services messages using XSLT in IBM Data Studio Developer

How to use the XSLT feature in Data Web Services to customize input and output Web service messages

developerWorks

Level: Intermediate

Kavitha Pullela (kpullela@us.ibm.com), Software Development Engineer, IBM
Michael Schenker (mschenk@us.ibm.com), Software Engineer, IBM

31 Jul 2008

Register now or sign in using your IBM ID and password.

IBM® Data Web Services is a part of IBM Data Studio Developer, the new unified tooling platform for IBM database servers. Data Web Services can be used to expose database operations and stored procedures as Web services without programming. You can further customize the messages that client applications send and receive from Web Services. This tutorial shows you how to apply XSL transformations to input and output messages to enable a variety of clients.

Objectives

  • To use the XSLT feature that is now part of Data Web Services.

  • To generate a default schema for a sample Web service.

  • To apply Web-style transformations to display the output in HTML, JSON, and RSS formats.

  • To apply your custom schemas to SOAP messages.

Prerequisites

This tutorial is written for database programmers who are familiar with IBM Data Studio and know how to perform common tasks such as creating a database connection, a data development project, and SQL scripts or stored procedures. If you are not already familiar with these tasks, you should first complete the tutorial "IBM Data Studio: Get started with Data Web Services" (developerWorks, November 2007). Basic knowledge of XSLT, XSD, and XPath is recommended. Because the examples in the tutorial are all based on WebSphere® Application Server Community Edition server as the target environment, the tutorial assumes that the reader has Data Studio Developer 1.2 installed along with a WebSphere Application Server Community Edition server instance, and a connection to the DB2 SAMPLE database has been set up.


System requirements

To run the examples in this tutorial, you need:



Formats

html, pdf


Tutorial overview

A powerful feature of Data Web Services is the capability to apply server-side XSL transformations to Web service requests and responses. This feature allows you to customize the format of the messages that the client sees. This is particularly useful in cases where enterprise or industry Web service format requirements dictate what the Web services messages should look like.

Data Web Services has a default message format when it comes to Web service request and response messages. The message format and the XML tag names in those messages depends on the Web service operation name, result set column-names, and so on. In some cases, you may not want the client to see the default tag names, either due to message format requirements, or because you simply want to mask the default tag names. Using the server-side XSLT feature, incoming XML requests and outgoing results can be made to look different than the Data Web Services default message format.

In general, Web services can be built using either a top-down or bottom-up approach. In a top-down approach, you start with a service specification (for example, a WSDL file) and then implement the underlying code to match that specification. In a bottom-up approach, you start with a Java bean or SQL statement and expose the functionality as Web services. Using the Data Web Services, you start with the DML operations (for example, queries) and expose them as Web services. Therefore, the development style is typically bottom-up. However, by applying XSLT to the service messages, in many cases, you can map the service format of the bottom-up style messages to the top-down design. This alleviates some of the top-down service format requirements while allowing you to develop bottom-up Web services. The transformation can also be used to deliver data to the client in human readable formats such as HTML, JSON, RSS feeds, or any text format that can result from an XSL transform.

This tutorial introduces you to creating and deploying IBM Data Web Services on an application server and also gives an in-depth overview of how to use the XSLT feature to customize the input and output messages of a sample Web service to fit into your custom XML schema.

Share this....

digg Digg this story del.icio.us del.icio.us Slashdot Slashdot it!


Back to top


Document options

Document options requiring JavaScript are not displayed


My developerWorks needs you!

Connect to your technical community