users@jax-rpc.java.net

specifying a serializer for java classes via wscompile config.xml file

From: Peter Feng <Peter.Feng_at_Sun.COM>
Date: Fri, 05 May 2006 12:14:50 -0700

My environment is JAXRPC from the JWSDP2.0.
I have an exception complaining: no serializer registered for my java class com.movie.RequestTO which happens to be a custom class that serves as one of the input message arguments to the WebService endpoint. I have no problems serializing a java.util.Vector. Please help. My client generated classes and java files are no different when I include type mapping and serializerFactory attributes(I thought that perhaps the additional references in the XML file to a serializerFactory would exist in the java sources).
--
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4808167
     [java] e has exception:serialization error: no serializer is registered for
 (class com.movie.RequestTO, null); nested exception is:
     [java]     serialization error: no serializer is registered for (class com.
movie.RequestTO, null)
     [java] java.rmi.RemoteException: serialization error: no serializer is regi
stered for (class com.movie.RequestTO, null); nested exception is:
     [java] Caused by: serialization error: no serializer is registered for (cla
ss com.movie.RequestTO, null)
     [java]     at com.sun.xml.rpc.encoding.DynamicSerializer.getSerializerForOb
ject(DynamicSerializer.java:109)
     [java]     at com.sun.xml.rpc.encoding.DynamicSerializer.serialize(DynamicS
erializer.java:87)
--
I have the following wsdl which I am trying to generate a stub from
<wsdl:message name="STARTRequest">
  <wsdl:part name="RequestTO" type="xsd:anyType" /> 
  <wsdl:part name="username" type="xsd:string" /> 
  <wsdl:part name="password" type="xsd:string" /> 
  <wsdl:part name="piName" type="xsd:string" /> 
  <wsdl:part name="priority" type="xsd:string" /> 
  </wsdl:message>
<wsdl:operation name="START" parameterOrder="RequestTO username password piName priority">
  <wsdl:input message="impl:STARTRequest" name="STARTRequest" /> 
  <wsdl:output message="impl:STARTResponse" name="STARTResponse" /> 
  </wsdl:operation>
-----------------
I have modified my config file as follows to map the RequestTO class which has xsd:anyType in the server wsdl to
a local client schema which I generated from the java class. And made the following modifications in the bindings below.
I included the axis.jar in my classpath(to gain access to the BeanSerializerFactory which I was hoping would be the dynamic serialized class).  I was hoping to get different compiled artifacts with the additional type-mapping lines in config.xml, but the size of the generated java files and classes was identical with and without the type-mapping lines.
ANT BUILD 
<wscompile
         keep="true"
         client="true"
         base="${samplesbuild}/${appname}/classes/client"
         xPrintStackTrace="true"
         verbose="false"
         classpath="${compile.classpath}"
         config="${sbmconfig.rpcenc.file}">
         <classpath>
            <path refid="compile.classpath"/>
         </classpath>
    </wscompile>
CONFIG.xml
<wsdl location="http://localhost:8181/sbm/wsdl/MovieRental.wsdl"
        packageName="com.movie">
         <typeMappingRegistry>
         <import>
         <schema namespace="http://www.w3.org/2001/XMLSchema" location="schema1.xsd"/>
         </import>
         <typeMapping encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<entry schemaType="xs:requestTO"
            javaType="com.movie.RequestTO"
            serializerFactory="org.apache.axis.encoding.ser.BeanSerializerFactory"
            deserializerFactory="org.apache.axis.encoding.ser.BeanDeserializerFactory"
            xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
    		</typeMapping>
         <additionalTypes>
             <class name="com.movie.RequestTO"/>             
          </additionalTypes>
          </typeMappingRegistry>