You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by karim <k....@clipack.com> on 2004/07/28 17:19:07 UTC

Problem Serialization/Deserialization with the BeanSerializer/Deserializer

Hi all axis-users,
I wanted to get on the client side a bean created on the server side.

The bean is described as follow :

public class XMLRepresentation implements java.io.Serializable {
 
  private byte[] xmlRepresentation_;
 
  public XMLRepresentation() {
  }
 
  public XMLRepresentation(Object representation) {
    createXMLRepresentation(representation);//fill the byte[] with a 
representation.toString().getBytes();
  }
 
  public byte[] getXMLRepresentation() {
    return (byte[])xmlRepresentation_.clone();
  }
}

In order to get it on the client side, I created a service corresponding 
to the method :
  public XMLRepresentation createXmlRepresentation()
  throws ServiceException {
    XMLRepresentation rep = new XMLRepresentation(getRepresentation());
    System.out.println(rep);
    return rep;
  }

my deploy.wsdd file contains the line :
  <beanMapping qname="myNS:XMLRepresentation" 
xmlns:myNS="urn:ConfiguratorManager" 
languageSpecificType="java:XMLRepresentation"/>

On the client side, I do :
QName qn = new QName("urn:ConfiguratorManager", "XMLRepresentation" );
     
call.registerTypeMapping(XMLRepresentation.class, qn,
                             new 
org.apache.axis.encoding.ser.BeanSerializerFactory(XMLRepresentation.class, 
qn),       
                             new 
org.apache.axis.encoding.ser.BeanDeserializerFactory(XMLRepresentation.class, 
qn));

 call.setOperationName(new QName("http://soapinterop.org/", 
"createXmlRepresentation"));
 XMLRepresentation rep = (XMLRepresentation)conveyor.invoke(new Object[] 
{});


EveryThing seems to work well except the fact that the byte array is null!!
I know that, on the server side, the byte array is conformed.
It seems that the byte array isn't serialized from the server  to the 
client.


I hope that I've clearly exposed my problem and that somebody will help  me.

Thank by advance
Karim