Stream Processing Demo  Locate

Overview  Locate

This demo shows how to access and process SOAP messages at the XML/SOAP level in a stream-based manner. Stream-based processing of a message can be useful when a service processes large XML/SOAP documents and the classical approach using the tree-like SAAJ API is too memory consuming.

To demonstrate stream-based processing functionality, we have created a simple service that calculates a total price including tax based on tax value. The tax value isn't directly in the outgoing SOAP message, which is reading from the inData.xml file. Instead, a message handler fills in this value in the SOAP message based on country. Both the service and the message handler process the SOAP message in a stream-based manner using the tokenizer. Because the processed message can be very large, the client uses asynchronous invocation to perform the call. The response SOAP message is saved to the outData.xml file.

The XML messages in this demo use a SOAP protocol that looks like the following:

<envelope>
	<body>
		<items>
			<item><amount>10</amount><country>CZK</country><tax/><sum/></item>
			<item><amount>10</amount><country>US</country><tax/><sum/></item>
			....
		</items>
	</body>
</envelope>

The handler modifies the message in the following way:

<envelope>
	<body>
		<items>
			<item><amount>10</amount><country>CZK</country><tax>22</tax><sum/></item>
			<item><amount>10</amount><country>US</country><tax>22</tax><sum/></item>
			....
		</items>
	</body>
</envelope>

The service modifies the message in the following way:

<envelope>
	<body>
		<items>
			<item><amount>10</amount><country>CZK</country><tax>22</tax><sum>12.2</sum></item>
			<item><amount>10</amount><country>US</country><tax>22</tax><sum>10</sum></item>
			....
		</items>
	</body>
</envelope>

This message is at the same time sent to the client as a response.

Demo Package Description  Locate

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

File or directoryDescription
inData.xml

SOAP message to process

src/demo/advanced/streamprocessing/server/

Server source code

src/demo/advanced/streamprocessing/client/

Client source code

src/package.xml

Deployment descriptor

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. Ensure that you have not started SESJ.

  2. Compile the server classes.

    Windows: run.bat make_server
    Linux:   ./run.sh make_server
    
  3. Run StreamProcessingServer (it starts SESJ and publishes StreamProcesingService class).

    Windows: run.bat run_server
    Linux:   ./run.sh run_server (use a new terminal)
    
  4. Make the client classes.

    Windows: run.bat make_client
    Linux:   ./run.sh make_client
    
  5. Run StreamProcessingClient (it calls StreamProcessingService):

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

    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 StreamProcessingService.

    Windows: run.bat make_service
    Linux:   ./run.sh make_service
    
  3. Deploy StreamProcessingService 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 StreamProcessingClient (it calls StreamProcessingService).

    Windows: ./run.bat run_client
    Linux:   ./run.sh run_client
    
  6. Undeploy StreamProcessingService from the SESJ.

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