Java WSDP Components


The components that come with the Java WSDP download can be classified into four broad categories, shown in Figure 8.1: Java XML APIs and reference implementations, development and deployment toolsets, the runtime environment, and supporting specifications.

click to expand
Figure 8.1: Java WSDP components

Java XML APIs

  • Java API for XML Processing (JAXP). JAXP exposes standard XML parsing and validation APIs for processing and transforming XML documents in Java. JAXP 1.2_01 provides support for DOM, SAX, XSLT, and XML schemas. The download comes with the APIs and the Apache Xerces parser and XSLTC. JAXP provides a framework that allows you to use any compliant parser and transformation engine instead of the supplied implementations.

  • Java API for XML-based Remote Procedure Calls (JAX-RPC). JAX-RPC is used to create Java Web service producers that use SOAP 1.1-based remote procedure calls. JAX-RPC also can be used to develop Java Web service consumers of these RPC services.

  • Java API for XML Messaging (JAXM). JAXM provides an abstraction over messaging transports and enables Java applications to send and receive document-oriented XML messages. JAXM implements SOAP 1.1 and relies on the SAAJ specification for support of SOAP with attachments.

  • SOAP with Attachments API for Java (SAAJ). SAAJ enables applications to create messages conforming to the SOAP with Attachments note. Initially a part of the JAXM API, it is now a separate API, because it is used by other JAX APIs as well.

  • Java API for XML Registries (JAXR). JAXR provides a uniform API for accessing and modifying entries in both ebXML and UDDI registries.

  • Java Architecture for XML Binding (JAXB). JAXB enables an XML schema (or DTD) to be transformed into the equivalent Java classes. The generated classes handle the details of parsing instance XML and adhering to all schema constraints. When we started work on this book, the JAXB specifications were still in draft stages and an implementation was not shipped with the Java WSDP download. The Java WSDP release now includes a JAXB 1.0 implementation.

Java WSDP Runtime

Java WSDP comes with the Tomcat Web container, which supports the Servlet 2.3 specification. The Tomcat engine can be started and stopped using the supplied scripts startup/shutdown or can be administered from the browser using the administration console at http://localhost:8080/admin, (shown in Figure 8.2).

click to expand
Figure 8.2: The Tomcat Web server administration console

A registry is also an essential part of Web services architecture. Java WSDP comes with a registry server that can be used to test programs written with JAXR. The included registry supports UDDI v. 2 and is to be used as a private registry. The registry uses a native XML database, Xindice (from Apache), and provides a GUI tool to browse and modify registry entries. Setting up the registry is discussed in Chapter 12.

Java WSDP Tools

Ant

Ant is a versatile toolkit used in the context of Java Web service and J2EE to build and deploy applications. Ant's power and versatility as a build tool is evident by the fact that many Integrated Development Environments (IDEs) provide integrated Ant support. Even if you are using Ant from the command line, it is simple to deploy Web service components on a large scale. The default Ant download comes with several built-in tasks (JAR, ZIP, CAB, copy, FTP) and some product- or platform-specific tasks (for Junit testing, EJBC, etc.) in a separate optional download. Java WSDP comes with prebuilt Ant tasks for compiling stubs and skeletons and for deploying Web services to the Tomcat container.

Before using Ant to deploy Web services, you should create a build.properties file in your home directory. The file should have the username and password of the Tomcat administrator:

 username=<user> password=<password> 

wsdeploy

The wsdeploy tool comes with the Java WSDP package. It is used to create a deployable WAR file that contains all the information necessary to create a JAX-RPC endpoint. The WAR file must then be deployed to Tomcat. Before looking at the syntax for invoking these tools, let's take a look at how a JAX-RPC program is deployed into the Tomcat container. This will provide a high-level introduction to these tools and to Ant. The sample Ant tasks and targets file shown in Figure 8.3 is a modified version of the scripts that come with the Java WSDP tutorial.

click to expand
Figure 8.3: Sample tasks for creating a JAX-RPC server

Note that wsdeploy is a standalone tool and can be used without using Ant. Figure 8.4 shows the working model.

click to expand
Figure 8.4: The wsdeploy tool

The syntax for usage is:

 wsdeploy <options> <input war file>.   where <options> are  :   -classpath <path>    :   classpath (optional)   -tmpdir <directory>  :   working directory for generated, temporary files   -keep                :   keep temporary files generated (including WSDL                            corresponding to the service)   -o <output war file> :   (required) location of the generated,deployable war file   -verbose             :   verbose output   -version             :   print version information 

The input WAR file contains the server-side classes and two manifest files. The first is the web.xml file, which contains the standard Web application information (see below). The second is, in this particular case, a file specific to JAX-RPC programs created using the Java WSDP and is explained in Chapter 10.

wscompile

The wscompile tool is used to generate the client-side stubs for RPC Web services. This tool is a newer version of the xrpcc tool. (Both provide similar functionality now, but xrpcc will presumably be replaced by wscompile in future releases). The Ant tasks shown below are a high-level illustration of how a JAX-RPC client is packaged.

The Ant tasks above provide an overview of the steps needed to create and JAR a JAX-RPC client. These are shown in Figure 8.5. The syntax for invoking wscompile to generate stubs and/or ties is

click to expand
Figure 8.5: Sample tasks for creating a JAX-RPC client

 wscompile [options] configuration_file where [options] include:   -classpath <path>         classpath   -d <directory>            destination of generated output files   -g                        generate debugging info   -gen                      same as -gen:client   -gen:client               generate client artifacts (stubs, etc.)   -gen:server               generate server artifacts (ties, etc.)   -gen:both                 generate both client and server artifacts   -keep                     keep generated files   -s <directory>            location for generated source files   -verbose                  output messages about what the compiler is doing   -version                  print version information 

The configuration file is specific to wscompile. In this example, it provides the location of the WSDL file, so that client-side stubs can be generated from it. The listing below shows a sample configuration file used to generate client-side stubs (i.e., with the gen:client option). A more complete explanation of the configuration file is provided in Chapter 10.

 <?xml version="1.0" encoding="UTF-8"?> <configuration     xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">    <wsdl location=" WSDL location"         packageName="generated file package name"/> </configuration> 

As seen from the syntax for invoking wscompile, the tool can be used to generate both client-side stubs and server-side ties. So far, we have used wsdeploy to generate and package server-side ties. Although not documented, wsdeploy presumably uses wscompile internally, passing it the gen:server argument to generate server-side ties.

Registry Browser

The registry browser is a GUI tool that can be used to search and add information to a UDDI registry. This is shown in Figure 8.6. It is implemented as a JAXR client and can be used to browse any registry, including the supplied Java WSDP registry. The code for this registry browser (JAXR) can be found in the JAXRClient.java class in the <JWSDP_HOME>/samples/jaxr/jaxr-browser directory.

click to expand
Figure 8.6: The registry browser

Complete examples of using Ant, wscompile, wsdeploy, and the registry tool are provided in the Java WSDP tutorial, available at http://java.sun.com/webservices/docs/1.0/tutorial/doc/JavaWSTutorialTOC.html.

Java WSDP Supporting Specifications

Although not directly a part of the XML APIs, the Java WSDP supporting specifications form the core infrastructure of a Web services application and are shipped with the WSDP.

  • Java Server Pages Standard Tag Library (JSTL). JSTL is a set of commonly used custom JSP tags, a framework for creating new tags, and an expression language that helps simplify page development. JSTL is explained in depth in Appendix B.

  • Java Server Faces. Java Server Faces, a future technology, will include a standard set of JSP tags aimed at providing a single framework for creating complex HTML forms and HTML form elements within the JSP environment. Version 1.0 of Java WSDP does not include this technology.

  • Java Server Pages and Servlets. JSP 1.2 and Servlet 2.3 are supported in this release of Java WSDP. JSP and Servlet technologies form the foundation technologies for Java Web services. As mentioned earlier, Java WSDP is shipped with the Tomcat engine, which provides support for these two specifications.




Java Web Services Architecture
Java Web Services Architecture (The Morgan Kaufmann Series in Data Management Systems)
ISBN: 1558609008
EAN: 2147483647
Year: 2005
Pages: 210

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net