XSLT Demo  Locate

Overview  Locate

This demo shows how to do the following:

  • Communicate with a Web service from an HTML Form using a custom interceptor, and

  • Change an outgoing SOAP message from the Web service to HTML output using XSLTInterceptor

To achieve this, a simple Xslt service and two clients (java and HTML) have been implemented.

Java Client

The java client looks up the service and adds and removes some "to do" items. This client doesn't use any interceptors.

HTML Client

The HTML client works a little differently. The HTML page contains an HTML form that is submitted with the HTTP "post" method. The sent message is processed by the HTMLFormInterceptor, which creates a SOAP message according to the form data. The following parameters are expected by HTMLFormInterceptor:

__methodName - contains the name of method to invoke (required)
__methodNamespace - contains the namespace of method (required)
__paramOrder - contains the order of parameters of the method (optional)
method's parameters - all parameters are listed in __paramOrder (optional)

The XSLTInterceptor and its stylesheet transform the outgoing SOAP message from the Xslt Web service into HTML.

Demo Package Description  Locate

In addition to the files described in Files and Directories, this demo contains:

File or directoryDescription
src/demo/advanced/xslt/server/XsltService.java

Implementation of the service (simple ToDo List)

src/demo/advanced/xslt/server/HTMLFormInterceptor.java

Implementation of the HTMLFormInterceptor (creates a SOAP message from HTML Form parameters)

src/demo/advanced/xslt/server/out.xsl

Outputs the stylesheet for the XSLTInterceptor

src/demo/advanced/xslt/client/XsltClient.java

Implementation of the java client

src/demo/advanced/xslt/server/client/XsltClient.html

HTML for creating request messages from an HTML Form

src/package.xml

The service's deploymenent descriptor

Prerequisites and Preparatory Steps  Locate

The demo assumes that you have installed the following components:

XSLT-Interceptor
xsltinterceptor.jar         -  on the server and client side

Building and Running Demos  Locate

You can run the demo using the "run.sh" (for Unix) or "run.bat" (for Windows) scripts. Running the script without arguments prints out a help message on screen.

The demo can be run in two different ways:

Runtime Publishing  Locate

To use Runtime Publishing, follow these steps:

  1. Be sure that you have not started SESJ.

  2. Compile the server classes.

    Windows: run.bat make_server
    Linux:   ./run.sh make_server
    
  3. Run XsltServer (it starts the SESJ and publishes XsltService class).

    Windows: run.bat run_server
    Linux:   ./run.sh run_server (use a new terminal)
    

    You can look at XsltService WSDL on 'http://localhost:6060/demo/advanced/XsltJavaService/wsdl' from your browser.

  4. Make the client classes.

    Windows: run.bat make_client
    Linux:   ./run.sh make_client
    
  5. Run JavaClient (it calls XsltService).

    Windows: run.bat run_client
    Linux:   ./run.sh run_client
    
  6. Run the HTML client. Open the file demo/advanced/xslt/src/demo/advanced/xslt/client/XsltClient.html in a JavaScript-enabled browser.

    If you wish to follow the progress of the invocation with SoapSpy, perform the following:

    1. Run server_java60/bin/soapspy.bat or soapspy.sh. This will bring up the SoapSpy GUI.

    2. Start spying by selecting Start Spying from the Spy menu or by clicking the spy icon in the main pane.

    3. Run the client using the run spy_client command instead of run_client.

Persistent Deployment  Locate

To run using Persistent Deployment:

  1. Be sure that you have started SESJ.

  2. Compile the XsltService.

    Windows: run.bat make_service
    Linux:   ./run.sh make_service
    
  3. Deploy XsltService on the SESJ.

    Windows: run.bat deploy_service
    Linux:   ./run.sh deploy_service
    
  4. Make the client classes.

    Windows: run.bat make_client
    Linux:   ./run.sh make_client
    
  5. Run the JavaClient (it calls XsltService).

    Windows: run.bat run_client
    Linux:   ./run.sh run_client
    
  6. Run the HTML client. Open the file demo/advanced/xslt/src/demo/advanced/xslt/client/XsltClient.html in a JavaScript-enabled browser.

  7. Undeploy the XsltService from the SESJ.

    Windows: run.bat undeploy_service
    Linux:   ./run.sh undeploy_service