This demo shows how to perform simple SOAP messaging. For this demo, we create simple XML messages using a SOAP protocol that looks like the following:
<envelope> <header> <target>http://localhost:6060/messaging/Happy</target> <target>http://localhost:6060/messaging/Bashful</target> <target>http://localhost:6060/messaging/Sneezy</target> <target>http://localhost:6060/messaging/Sleepy</target> <target>http://localhost:6060/messaging/Grumpy</target> <target>http://localhost:6060/messaging/Dopey</target> </header> <body> <message>Hello Doc !!!</message> </body> </envelope>
We have the message endpoints in the header section and a string message in the body section.
When the message arrives, each messaging service will:
print the message from the body of the arriving message.
obtain the target from the header.
create the new message with the rest of header.
put a new string message into the body of the outgoing message.
The Client creates the new message with all the endpoints and sends it to the first target. The message is then resent to the next target and so on.
If you are interested in running this demo over JMS transport, please see Running Demos Over JMS Transport.
In addition to the files described in Files and Directories, this demo contains:
File or directory | Description |
---|---|
src/demo/advanced/messaging/server/ | Server source code |
src/demo/advanced/messaging/client/ | Client source code |
src/package.xml | Deployment descriptor |
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:
To use Runtime Publishing, follow these steps:
Ensure that you have not started SESJ.
Compile the server classes.
Windows: run.bat make_server Linux: ./run.sh make_server
Run MessagingServer (it starts SESJ and publishes MessagingService class).
Windows: run.bat run_server Linux: ./run.sh run_server (use a new terminal)
Make the client classes.
Windows: run.bat make_client Linux: ./run.sh make_client
Run MessagingClient (it calls MessagingService):
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:
Run server_java60/bin/soapspy.bat or soapspy.sh. This will bring up the SoapSpy GUI.
Start spying by selecting Start Spying from the Spy menu or by clicking the spy icon in the main pane.
Run the client using the run spy_client command instead of run_client.
To run using Persistent Deployment:
Be sure that you have started SESJ.
Compile MessagingService.
Windows: run.bat make_service Linux: ./run.sh make_service
Deploy MessagingService on the SESJ.
Windows: run.bat deploy_service Linux: ./run.sh deploy_service
Make the client classes.
Windows: ./run.bat make_client Linux: ./run.sh make_client
Run MessagingClient (it calls MessagingService).
Windows: ./run.bat run_client Linux: ./run.sh run_client
Undeploy MessagingService from the SESJ.
Windows: run.bat undeploy_service Linux: ./run.sh undeploy_service