Sun Java System logo     
JAXM Simple Sample Application



JAXM Simple Sample Application


This document describes how to utilize the JAXM Simple sample application in conjunction with the Sun Java (tm) System Application Server version 7.

This sample application document contains the following sections:



Overview

The purpose of this document is to demonstrate the support for the Java API for XML Messaging in the Sun Java (tm) System application server.

Overview of the Java API for XML Messaging
The Java™ API for XML Messaging (JAXM) Optional Package enables applications to send and receive document oriented XML messages using a pure Java API. JAXM implements Simple Object Access Protocol (SOAP) 1.1 with Attachments messaging so that developers can focus on building, sending, receiving, and decomposing messages for their applications, instead of programming low level XML communications routines.

The purpose of this application is to demonstrate the usage of JAXM SOAP messaging in the Sun Java (tm) System Application Server. In this sample application, there is simply an HTTP servlet that sends a SOAP message that is received by another JAXM servlet to illustrate a roundtrip JAXM message exchange.

The application has two servlets: SendingServlet.java which simply sends a SOAP message, and ReceivingServlet.java which receives this SOAP message and sends back a response.

The servlet ReceivingServlet is a SOAP message endpoint (for example, it consumes SOAP messages). This servlet uses the javax.xml.messaging.JAXMServlet class to implement a servlet that receives a SOAP message and echoes a SOAP message back as an acknowledgement.

For more information on JAXM, go to http://java.sun.com/xml/jaxm/index.html.

The source code is located at

<install_root>/samples/webservices/jaxm/simple/src/ .


Compiling and Assembling the Application



This section describes how to compile and assemble the application using a Command Line Interface.

See the Sample Application Build Facility document for details on using a build facility.

To rebuild the entire application from scratch, perform the following steps:

  1. Compile and assemble the application.

    Execute the asant command under <install_root>/samples/webservices/jaxm/simple/src.

  2. Create Javadocs for the application.

    Execute the asant javadocs command under <install_root>/samples/webservices/jaxm/simple/src/.

    The Javadocs are created under <install_root>/samples/webservices/jaxm/simple/javadocs.

  3. Clean the web application project area (optional).

    Execute the asant clean command under <install_root>/samples/webservices/jaxm/simple/src/.
    This will clean the application build and assemble area.


Deploying the Sample Application

To deploy the application, do the following:

Execute the command asant deploy under <install_root>/samples/webservices/jaxm/simple/src

This will deploy the jaxm-simple.war file located under <install_root>/samples/webservices/jaxm/simple/


Note You must run asant undeploy before redeploying this sample. This will ensure that all modules are undeployed and the resources are disabled.




Verifying Deployment

As an optional step, you can use the Sun Java (tm) System Application Server Administration Tool to verify that the application has been registered. Otherwise, proceed directly to Running the Sample Application.

To verify the registration of the application, do the following:

Execute the command asadmin list-components to look at applications deployed with a server instance. For example:

<install_root>/bin/asadmin list-components -u <username> -w <password> -H <host> -p <port> <server instance name>

You will see jaxm-simple listed.


Running the Sample Application



You can run the application through the following URL:

http://<hostname>:<port>/jaxm-simple

The files created by the sample, sent.msg and reply.msg, are located under <install_root>/domains/domain1/<server-instance>/config/ .

Troubleshooting



  • If you encounter problems when running the application, review the log files at <install-root>/domains/domain1/<server-instance>/logs/server.log to learn what exactly went wrong.



Copyright © 2002 Sun Microsystems, Inc. All rights reserved.

Last Updated July 12, 2002