users@jax-rpc.java.net

Re: Serialization Error (Dynamic Invocation with custom objects)

From: Lila <lilatene_at_HOTMAIL.COM>
Date: Tue, 03 Dec 2002 01:06:16 -0700

hi,

Thank you for replying to my message. I've tried to follow the
suggestions in your e-mail but I still haven't been able to get the
Hello Proxy example to work with a custom object, so I must be
missing something... I'm trying to use wscompile so that I can
incorporate this process into ant later on, but I'm not sure if I'm
using wscompile correctly (before this I had only used it to generate
stubs for the static client, and I didn't know it was also used for
Dynamic clients).

I've been using the config.xml file you gave as an example, but
I changed the targetNamespace and typeNamespace to match the ones
in the Hello example, and I changed service name from
Interface_service to MyHello after getting an error message.

I'm unclear if the output of wscompile should be packaged with the
client or the server, or both? I've tried various combinations of
wscompile options and packaging and nothing has worked so far. I've
looked at the output of wscompile and it does seem to generate code to
register the serializer for HelloObject in MyHello_SerializerRegistry,
but no matter what I do I still get the same error message ("no
serializer is registered...").

thanks in advance for any help,

Lila

On Mon, 2 Dec 2002 20:16:02 -0800, Dharam <dharmendrasankhla_at_YAHOO.COM>
wrote:

>
> hi Lila
> yes you can serialize and deserialize interface/abstract classes
> with the JAXRPC ri, there is nothing like bug, u have to provide
> additional classes while u making ur WAR file. if u r using deploytool
> do one thing while creating WAR file at the end use Customize Model
> Settings option and in the Optional Model Settings use identify
> Referenced Classes... , here u can add ur additional classes
> deployetool will generate serializer and deserializer for u.
>
> and if u r using wscompile, requires that you specify in the
> wscompile config file all of the subclasses that will be used at
> run-time. You do this by adding <additionaType> elements. Here is an
> example.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <configuration
> xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
> <service name="Interface_service"
> targetNamespace="http://tempuri.org/wsdl"
> typeNamespace="http://tempuri.org/types"
> packageName="proxy">
> <interface name="proxy.Interface"
> servantName="proxy.InterfaceImpl"/>
> <typeMappingRegistry>
> <additionalTypes>
> <class name="proxy.HelloObject"/>
> <class name="proxy.HiObject"/>
> </additionalTypes>
> </typeMappingRegistry>
> </service>
> </configuration>
> and use wscompile with -server option so it will generate serializer
> and deserializer for ur additional classes.
> hope this will help u out.
> Regards
> Dharam
>
> Lila <lilatene_at_HOTMAIL.COM> wrote:
>> hi,
>>
>> I am trying to pass custom objects / beans in JAX-RPC using
>> Dynamic Proxy invocation, but whenever I try this I get a
>> serialization error, telling me that no serializer is
>> registered for the custom class. I thought that JAX-RPC
>> should take care of generating and registering the serializer.
>> If I use a static client instead (generating stubs with
>> wscompile) everything works fine.
>>
>> To get the simplest example possible of this problem, I
>> modified the Dynamic Proxy "Hello" example from the JWSDP
>> tutorial, adding a very simple HelloObject class and a
>> "sayHelloObject" method to the Interface and Implementation
>> classes.
>>
>> Here is the source code for the HelloObject class:
>>
>> package proxy;
>>
>> public class HelloObject {
>>
>> String value;
>>
>> public HelloObject() {
>> }
>>
>> public void setValue(String v) {
>> value = v;
>> }
>>
>> public String getValue() {
>> return value;
>> }
>>
>> public String toString() {
>> return "Hello Object with value: " + value;
>> }
>> }
>>
>> And here is the sayHelloObject method:
>>
>> public HelloObject sayHelloObject(String s) {
>> HelloObject ob = new HelloObject();
>> ob.setValue(s);
>> return ob;
>> }
>>
>> If I call sayHelloObject from a static client everything works
>> fine, but if I run the dynamic proxy client I get the following
>> error:
>>
>> serialization error: no serializer is registered for (null, {http://com.test/types/MyHello}HelloObject)
>> at com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.getSerializer(DynamicInternalTypeMappingRegistry.java:62)
>> at com.sun.xml.rpc.encoding.soap.SOAPResponseSerializer.initialize(SOAPResponseSerializer.java:72)
>> at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.initialize(ReferenceableSerializerImpl.java:47)
>> at com.sun.xml.rpc.client.dii.BasicCall.createRpcResponseSerializer(BasicCall.java:436)
>> at com.sun.xml.rpc.client.dii.BasicCall.getResponseDeserializer(BasicCall.java:410)
>> at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:279)
>> at com.sun.xml.rpc.client.dii.CallInvocationHandler.doCall(CallInvocationHandler.java:96)
>> at com.sun.xml.rpc.client.dii.CallInvocationHandler.invoke(CallInvocationHandler.java:68)
>> at $Proxy0.sayHelloObject(Unknown Source)
>> at hello.HelloClient.main(Unknown Source)
>>
>> CAUSE:
>>
>> no serializer is registered for (null, {http://com.test/types/MyHello}HelloObject)
>> at com.sun.xml.rpc.encoding.TypeMappingUtil.getSerializer(TypeMappingUtil.java:41)
>> at com.sun.xml.rpc.encoding.InternalTypeMappingRegistryImpl.getSerializer(InternalTypeMappingRegistryImpl.java:287)
>> at com.sun.xml.rpc.encoding.DynamicInternalTypeMappingRegistry.getSerializer(DynamicInternalTypeMappingRegistry.java:47)
>> at com.sun.xml.rpc.encoding.soap.SOAPResponseSerializer.initialize(SOAPResponseSerializer.java:72)
>> at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.initialize(ReferenceableSerializerImpl.java:47)
>> at com.sun.xml.rpc.client.dii.BasicCall.createRpcResponseSerializer(BasicCall.java:436)
>> at com.sun.xml.rpc.client.dii.BasicCall.getResponseDeserializer(BasicCall.java:410)
>> at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:279)
>> at com.sun.xml.rpc.client.dii.CallInvocationHandler.doCall(CallInvocationHandler.java:96)
>> at com.sun.xml.rpc.client.dii.CallInvocationHandler.invoke(CallInvocationHandler.java:68)
>> at $Proxy0.sayHelloObject(Unknown Source)
>>
>> [I am using JWSDP 1.0.01 on Windows 2000].
>>
>> If anyone can let me know what I am doing wrong here I would
>> really appreciate it. Is Dynamic Proxy invocation not
>> supported with custom types? or maybe there is some bug here?
>>
>> thanks,
>>
>> Lila
>>