SE 550: Homework

Deadline: 5.30pm, Tuesday, 17 February 2004.


This week's homework is to extend the mini-SOAP protocol to support Java's Serializable interface, and the transient modifier.

You should download the src archive, and compile the SOAP test programs:

  java COM.sun.labs.javacc.Main -OUTPUT_DIRECTORY=ajeffrey/teaching/minisoap/ ajeffrey/teaching/minisoap/SoapReader.jj
  javac ajeffrey/teaching/minisoap/*.java
  javac ajeffrey/teaching/test/
  javac ajeffrey/teaching/test/

First run:

  java ajeffrey.teaching.test.TestUnserializableSoap

This tries to serialize some data which should not be serializable, and produces an error message. You should edit ajeffrey/teaching/minisoap/ until this code passes its test and prints:

  SHOULD HAPPEN ajeffrey.teaching.minisoap.SoapException: Trying to serialize unserializable object of type class ajeffrey.teaching.test.Unserializable

Once this is working, run:

  java ajeffrey.teaching.test.TestTransientSoap

This tries to serialize a transient unserializable field, which ought to work but does not. You should now edit ajeffrey/teaching/minisoap/ and ajeffrey/teaching/minisoap/SoapReader.jj until this code passes its test and prints:

<Object class="ajeffrey.teaching.test.ReallySerializable" id="handle1">
<String value="this can go out over the network"/>

Note: this is changing the XML to send a <Transient/> element to represent a transient field; such a field can be skipped over during deserialization.

Once you have edited both files and passed both tests, you should submit ajeffrey/teaching/minisoap/ and ajeffrey/teaching/minisoap/SoapReader.jj, as a zip archive together with any other files you edited, using Courses OnLine.