users@jax-rpc.java.net

Re: Client side objects not serializable

From: Clinton <clinton.bosch_at_gmail.com>
Date: Wed, 7 Sep 2005 07:10:39 +0000 (UTC)

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:

<types>
    <schema targetNamespace="http://dorado/types/"
xmlns:tns="http://dorado/types/"
xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://www.w3.org/2001/XMLSchema">
      <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
      <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
Clinton