Header Example

Contents

Overview

Demonstrates the use of a handler to manipulate SOAP Headers elements. The web service is running off a Stateless Session Bean (EJB 2.1).

Quick Start

Ensure that you have installed the required software and set up your environment. You must have OC4J running. If it is not running on localhost, port 8888, you'll have to modify the ANT script (build.xml) to use the correct host and port to your server.

Once you have the server configured and running, just type ant from the handlerchain directory. The service artifacts and implementation class will be compiled and placed into a WAR which is then placed into an EAR. The EAR will be deployed to OC4J. Next the stubs and client will be compiled. Finally the service will be invoked by the client and you should see the output both in the server's message output and on the stdout of the client.

Step By Step

Ant tasks have been configured for easy running of this demo.

  1. Generate the service artifacts:

    To create a deployable application, type.

     % ant gen-service 
    
    This should result in a j2ee webservices compliant application file: dist/helloService-ejb.ear.

  2. Deploy the Service and Bind the Application

    To deploy and bind the application.

    % ant deploy-demo 
    

    Visit the http test page by going to http://localhost:8888/creditService/creditService to make sure that the application has been deployed properly.

  3. Run the client

    In this step you will generate the stubs for the service. A client application uses a stub to invoke operations on a remote service. Examine the file client-config.xml. This is the configuration file that the WebServices Assembler (WSA) tool uses to generate the stubs. To generate the stubs type: ant gen-stubs. The source for the stubs will be placed in build/src/client.

  4. Run the demo

    To run the client, issue:

     % ant run-demo 
    
    You should see a result like :
        "Congratulations John  !
         You are approved for a new Credit Card !! ...."
    

Notes