users@jax-rpc.java.net

Re: Serialization Problem of UserDefined Type in JAX-RPC

From: Doug Kohlert <Doug.Kohlert_at_Sun.COM>
Date: Wed, 12 May 2004 12:30:45 -0700

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.

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.

Thanks for your interest in JAXRPC

Narinder Kumar wrote:

> Hi All,
>
> Important environment details :
>
> JWSDP 1.3
> Win 2000
> JAX-RPC 1.1
> JDK 1.4.2
>
> I am trying to implement a method in the WebService which should
> return an Array of Custom-Defined type. The method signatures are :
>
> public interface PeemsIF extends Remote {
>
> /.../
> public Application[] getAllApplications () throws RemoteException;
> }
>
> Application is a normal java class not implementing the JavaBeans
> Design pattern but respects all the constraints specified in JAX-RPC
> Specification Sec 5.4 for a custom type to be JAX-RPC value type like
> it does not have any public field, implements java.io.Serializable
> interface and has a default public Constructor :
>
> 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() {
> /..../
> }
>
> Application(String name, String log4jConfigFile, String
> appliConfigFile) {
> /../
> }
>
> /..../
> }
>
> When I try to compile and package all this in a WebService
> wscompile gives the following error :
>
> [echo] Running wscompile:
> [echo] D:\jwsdp-1.3\apache-ant\../jaxrpc/bin/wscompile.bat
> -define -d build -nd build
> -classpath build config-interface.xml -model build/model.gz
> [exec] error: invalid type for JAX-RPC structure:
> peemsproto.Application
> [exec] Result: 1
>
> peemsproto is the package for Application class. What am I missing ?
>
> I tried to change the method signature of Web Service for
> Application[] to more generic Object[] array. Now the compilation and
> deployment of the web service passes peacefully. But when the client
> tries to access this method, it gets the following exception :
>
> JAXRPC.TIE.04: Internal Server Error (serialization error: no
> serializer is registered for (class peemsproto.Application, null))
>
> Why are the errors different in both the cases ? What does "no
> serializer is registered" mean ? i.e. is there a way we can register
> our own custom defined types?
>
> Regards
> Narinder
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net For
> additional commands, e-mail: users-help_at_jax-rpc.dev.java.net


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Doug Kohlert
Sun Microsystems, Inc.            
doug.kohlert_at_sun.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net