LongObject Serialization Demo  Locate

Overview  Locate

This demo shows how to write a custom serializer and deserializer for the document/literal style.

For example, if you have written a Java service returning a java.lang.Long object, that object can represent either a numerical value or a <null>. There are some languages (such as C#) which may have a problem deserializing a <null> value into long data type.

For purposes of this demo, we assume that we have this same problem in a Java service. The Long object will be represented on the client side as a structure (which can be <null>) with the member: public long value.

To create the demo, the following steps were performed:

Firstly, an XML Schema structure was created for the LongObject object (src/LongObject.xsd).

Secondly, the custom serializer and deserializer were created for the LongObject object (src/demo/advanced/longobject/*.java).

Finally, using the deployment descriptor (src/serialization_package.xml), the LongObject serialization package is created and is deployed only on the server.

The code for the service doesn't need to be changed in any way. Instead, the generated WSDL for the service endpoint will present java.lang.Long as a LongObject. Thus client sees the structure and works with it appropriately.

[Note]Note

This demo works for the document/literal style only. For RPC/encoded style serialization view the MessageFormat demo.

Demo Package Description  Locate

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

File or directoryDescription
src/demo/advanced/longobject/server/

Server source code

src/demo/advanced/longobject/client/

Client source code

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.

This demo can only be run using Persistent Deployment.

Persistent Deployment  Locate

To run using Persistent Deployment:

  1. Be sure that you've started the SESJ.

  2. Compile the custom serializers package.

    Windows: run.bat make_serializer_package
    Linux:   ./run.sh make_serializer_package
    
  3. Deploy the custom serializers package.

    Windows: run.bat deploy_serializer_package
    Linux:   ./run.sh deploy_serializer_package
    
  4. Compile LongObjectService.

    Windows: run.bat make_service
    Linux:   ./run.sh make_service
    
  5. Deploy LongObjectService on the SESJ.

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

    Windows: run.bat make_client
    Linux:   ./run.sh make_client
    
  7. Run LongObjectClient (it calls LongObjectService).

    Windows: run.bat run_client
    Linux:   ./run.sh run_client
    
  8. Undeploy LongObjectService from the SESJ.

    Windows: run.bat undeploy_service
    Linux:   ./run.sh undeploy_service
    
  9. Undeploy the custom serializers package.

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