This demo shows how to write a custom serializer and deserializer for RPC/encoded style.
For demo purposes a user needs to send a java.util.MessageFormat object which doesn't conform to java-beans' style. As a result, SESJ will not be able to access it's member data and send it via SOAP.
To create the demo, the following steps were performed:
Firstly, an XML Schema structure was created for the MessageFormat object (src/MessageFormat.xsd).
Secondly, the custom serializer and deserializer were created for the MessageFormat object (src/demo/advanced/messageformat/*.java).
Finally, the deployment descriptor (src/serialization_package.xml) is used to create the MessageFormat serialization package. This is deployed on the server and added to classpath on the client.
Both the client and the server side now work with MessageFormat and the custom serializers and deserializes. Therefore, both the client and the server are able to serialize (write text to XML) and deserialize (create appropriate MessageFormat object) the data correctly.
![]() | Note |
---|---|
This demo works for RPC/encoded style only. For document/literal style serialization please view the LongObject demo. |
In addition to the files described in Files and Directories, this demo contains:
File or directory | Description |
---|---|
src/demo/advanced/messageformat/server/ | Server source code |
src/demo/advanced/messageformat/client/ | Client source code |
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.
This demo can ony be run using Persistent Deployment.
To run using Persistent Deployment:
Be sure that you've started the SESJ.
Compile the custom serializers package.
Windows: run.bat make_serializer_package Linux: ./run.sh make_serializer_package
Deploy the custom serializers package.
Windows: run.bat deploy_serializer_package Linux: ./run.sh deploy_serializer_package
Compile MessageFormatService.
Windows: run.bat make_service Linux: ./run.sh make_service
Deploy MessageFormatService 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 MessageFormatClient (it calls MessageFormatService).
Windows: run.bat run_client Linux: ./run.sh run_client
Undeploy MessageFormatService from the SESJ.
Windows: run.bat undeploy_service Linux: ./run.sh undeploy_service
Undeploy the custom serializers package.
Windows: run.bat undeploy_serializer_package Linux: ./run.sh undeploy_serializer_package