Dashboard > RIFE > ... > Webservices > Hessian webservice and Meta data merging
RIFE Log In | Sign Up   View a printable version of the current page.
Hessian webservice and Meta data merging


Added by Edwin Mol, last edited by Geert Bevin on Jul 11, 2006  (view change)
Labels: 
(None)

Using a Hessian webservice running on a RIFE back-end can be somewhat tricky...
More specifically when using meta data merged objects that you want to send over the wire, you might run into serialization problems if the webservice client was not started with com.uwyn.rife.test.RunWithEngineClassLoader.

You basically have two options:

  1. Start your client application with the com.uwyn.rife.test.RunWithEngineClassLoader, which means that you have to package the rife jar with your client application, or
  2. Use a custom serializer that will only serialize the bean, instead of the MetaData class that wraps it, be aware that in this case you loose the metadata merge facility on the client.

If you prefer the second scenario, you might want to use the serializer I wrote to solve serialization issues.

Here it is:

import java.io.IOException;
import com.caucho.hessian.io.AbstractHessianOutput;
import com.caucho.hessian.io.AbstractSerializer;
import com.caucho.hessian.io.JavaSerializer;
import com.uwyn.rife.site.MetaData ;
import com.uwyn.rife.site.Validated;

public class MetaDataSerializer extends JavaSerializer {
    public MetaDataSerializer(Class cl)  {
        super(cl);
    }

    @Override
    public void writeObject(Object obj, AbstractHessianOutput out) throws IOException  {
        MetaData metaData = (MetaData) obj;
        Validated validated = metaData.retrieveValidatedBean();
        //just serialize the main object
        super.writeObject(validated,out);
    }
}



Are you enjoying Confluence? Please consider purchasing it today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.1a Build:#515 May 19, 2006) - Bug/feature request - Contact Administrators