 | Level: Intermediate Nicholas Chase (nicholas@nicholaschase.com), Author, Web-Site Developer, Freelance
17 Aug 2004 In Part 5 of this tutorial series on analyzing data with XSLT, the MindMap Research Team decides to tie their data in with other services, pulling information from Amazon Web Services in response to information unearthed in the analysis. Web services provide information in XML, but it's rarely in the form that you want it, so this tutorial explains how to create an application that not only retrieves the Amazon data but also transforms it into XHTML and outputs it to the browser. The stylesheet shows how to pull XML information from multiple sources within a single transformation and also includes a device that alerts developers when Amazon changes the Web service, since changes in the feed can break the application.
Prerequisites
This tutorial is for developers who want to understand how to integrate Web services into an XSLT-based application. It explains how to send and receive SOAP messages, how to transform them with XSLT, how to integrate them with another document using the XSLT stylesheet's document() function, and how to get the stylesheet to send an e-mail to an administrator if there's a problem with the Web service. This tutorial assumes that you are familiar with the basic principles of XML and XSLT. You do not have to be familiar with Web services. It is helpful to be familiar with the Java language, but the concepts are applicable to any programming language. Other tutorials in this series are:
System requirements
You will need JavaScript enabled in your browser. To follow along with this tutorial, you'll need to have the following tools installed and working. For the command-line version (as opposed to the servlet version), you will need:
-
Java 2 Standard Edition 1.4 or another XSLT engine: The sample code uses Java 1.4 (available at http://java.sun.com/j2se/1.4.2/download.html, which has XSLT built in. If you're using Java 1.3 or earlier, you can download the Xalan XSLT processor, available at http://xml.apache.org/xalan-j/index.html. You also have the option to use another language and another engine, but you'll have to adapt those sections of code accordingly.
-
An XSLT development environment, and a Java development environment: You can develop Java and XSLT using a text editor, but you will find it easier if you use an IDE such as WebSphere Studio Application Developer. You can download a trial version at http://www.ibm.com/developerworks/websphere/downloads/WSADsupport.html.
-
A servlets engine: This tutorial demonstrates an XSLT transformation in a Java servlet, so you'll need a servlet engine such as Tomcat, available from http://jakarta.apache.org/tomcat/index.html. If you're using WebSphere Studio Application Developer, however, you can skip this step and use the WebSphere Test Environment.
-
The JavaMail API: The last step in this tutorial involves sending an e-mail using a Java class. To make this work, you must download both the JavaBeans Activation Framework (http://java.sun.com/products/javabeans/glasgow/jaf.html) and the JavaMail API (http://java.sun.com/products/javamail/).
Duration
Under two hours
Formats html, pdf
|  | |  |