users@jax-rpc.java.net

Re: Serialization Problem of UserDefined Type in JAX-RPC

From: Narinder Kumar <nkumarfr_at_aol.com>
Date: Fri, 14 May 2004 15:09:18 +0200
After looking carefully, it was an internal problem in my programme which was throwing the exception and was not related to JAX-RPC

Everything is now working fine. Thanks for the advice.

Narinder

Doug Kohlert wrote on 13/05/2004, 18:30:

> Narinder,
> This class should be fine now.  How is it used in your service endpoint
> interface?  Is it used as a parameter explicitly?
>
> Narinder Kumar wrote:
>
> >
> > Doug Kohlert wrote on 12/05/2004, 21:30:
> >
> > > Narinder,
> > > Section 5.4 does not say that it must not have any public fields. It
> > > states that if it does have public fields that the types of those
> fields
> > > must be valid JAXRPC types.  The problem with your Application
> class is
> > > that is does not have any public fields AND it does not conform
> the the
> > > JavaBean style.  Therefore, there is no data that can be sent over
> the
> > > wire.  If you add one public field, then just that field would be
> sent
> > > over the wire.  In short, whatever data you want sent over the
> wire will
> > > have to be stored in either a public field or a JavaBean style
> property.
> > >
> >
> > Thanks Doug,
> >
> > I changed my Application class a bit. I don' want any public fields in
> > my class so I  implemented getter/setter methods for all private
> > fields which I want to be exported (as explained also  in Section
> > 5.4.1 and 5.4.2 of Specs).
> >
> > Now the class looks something like :
> >
> > package peemsproto;
> >
> > public class Application implements Serializable {
> >
> >     private String name;
> >     private String log4jConfigFile;
> >     private String appliConfigFile;
> >     private Logger logger;
> >     private static Logger peemsLogger;
> >     private HashMap allRegisteredEvents;
> >
> >     public Application() {
> >     / Do Nothing Just for confirmation according to JavaBean
> >     }
> >
> >     public Application(String name, String log4jConfigFile, String
> > appliConfigFile) {
> >      /../
> >       }
> >
> >     public String getName() {
> >         return name;
> >     }
> >
> >     public void setName(String name) {
> >         this.name = name;
> >     }
> >
> >     public String getAppliConfigFile() {
> >         return appliConfigFile;
> >     }
> >
> >     public void setAppliConfigFile(String appliConfigFile) {
> >         this.appliConfigFile = appliConfigFile;
> >     }
> >
> >     public String getLog4jConfigFile() {
> >         return log4jConfigFile;
> >     }
> >
> >     public void setLog4jConfigFile(String log4jConfigFile) {
> >         this.log4jConfigFile = log4jConfigFile;
> >     }
> >
> >
> > I can now see all the 3 fields having getter/setter methods are
> > visible in generated WSDL file as :
> >
> > <complexType name="Application">
> > <sequence>
> > <element name="appliConfigFile" type="string" />
> > <element name="log4jConfigFile" type="string" />
> > <element name="name" type="string" />
> > </sequence>
> > </complexType>
> >
> > > Whenever you specify an Object[] in the interface, you must only send
> > > valid JAXRPC types.  Of course Application is not as I pointed out
> > > above.  Also, if you do plan on sending valid JAXRPC types you
> must make
> > > sure that your service endpoint interface references these types
> or you
> > > must specify the types in an <additionalTypes> element in your
> wscompile
> > > config.xml file.  By doing one or the other, the JAXRPC SI can
> generate
> > > serializers/deserializers for these types.
> > >
> >
> > But still when I try to access this method from client it gives me the
> > following exception:
> >
> > JAXRPC.TIE.04: Internal Server Error (JAXRPC.TIE.01: caught exception
> > while handling request: java.lang.ClassCastException)
> >
> > I can see the generated Stub files by wscomile utility (like
> > Application.class, Application_SOAPBuilder.class etc) but still the
> > problem remains.
> >
> > I have added the following lines in  config-interface.xml file of my
> > WebService :
> >
> >       <typeMappingRegistry>
> >          <additionalTypes>
> >            <class name="peemsproto.Application"/>
> >          </additionalTypes>
> >        </typeMappingRegistry>
> >
> > Where I am getting wrong ?
> >
> > I could not understand when you said : if you do plan on sending valid
> > JAXRPC types you must make sure that your service endpoint interface
> > references these types or ...?
> >
> > TIA
> > Narinder

--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@jax-rpc.dev.java.net For additional commands, e-mail: users-help@jax-rpc.dev.java.net