Re: Client side objects not serializable

From: Doug Kohlert <Doug.Kohlert_at_Sun.COM>
Date: Wed, 07 Sep 2005 13:05:46 -0700

In JAX-RPC the only way you can get this to work is to modify the
generated AccountAge class and make it Serializable.

However, JAX-WS, the follow on to JAX-RPC supports the generation of
Serializable beans via a JAXB customization. Have you tried JAX-WS?

Clinton wrote:

>Hi Doug
>I started on the server side with Java classes which included a Serializable
>object/bean called AccountAge which just contained primitives. This was then
>deployed, and the WSDL document that was generated contained a complexType
>element describing the AccountAge object as follows:
> <schema targetNamespace="http://dorado/types/"
> <import namespace=""/>
> <complexType name="AccountAge">
> <sequence>
> <element name="balance120" type="int"/>
> <element name="balance150" type="int"/>
> <element name="balance180" type="int"/>
> <element name="balance30" type="int"/>
> <element name="balance60" type="int"/>
> <element name="balance90" type="int"/>
> <element name="balanceCurrentCash" type="int"/>
> <element name="balanceCurrentTerms" type="int"/>
> <xsd:any maxOccurs="unbounded"/>
> </sequence></complexType></schema></types>
>Then on the client side I imported the WSDL file and used it to create my
>"Client side artifacts" which included the AccountAge object, but this generated
>object was now no longer Serializable.
>So I am not getting any errors(serverside or clientside) as far as the calling
>of the rpc is concerned, the server is responding correctly and returning a
>valid AccountAge object, but this object is now no longer Serializable, and
>since my client is infact an EJB ... I need a Serializable object to be able to
>return to my applications "true" client.
>So in this multi tiered app, the client requests his account age, this request
>goes to an EJB, which in turn does the rpc to the Web service. The Web service
>responds with the AccountAge bean, but then the EJB cannot pass this bean onto
>the client because RMI needs to use Serializable objects.
>Hope this is clear
>Thanks again
>To unsubscribe, e-mail:
>For additional commands, e-mail:

 - Doug