axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Jordahl <>
Subject RE: Is this a bug in serialization?
Date Tue, 02 Jul 2002 16:04:33 GMT
This is a feature of soap encoding.  
You only get a single copy of your object transmitted in the XML so the other side knows that
the two references are the same thing.
It sounds like we may need to change the hashcode function emitted by WSDL2Java (or you can
edit it by hand).
Tom Jordahl
-----Original Message-----
From: Naresh Bhatia []
Sent: Tuesday, July 02, 2002 12:00 PM
To: ''
Subject: Is this a bug in serialization?

I had sent the following message to the user list, but got no response. Perhaps it is more
appropriate for the developer list because it brings up an issue with Axis serialization.
I would really appreciate a response from the group.
Naresh Bhatia
-----Original Message-----
From: Naresh Bhatia []
Sent: Saturday, June 29, 2002 1:17 PM
To: ''
Subject: Is this a bug in serialization?

I am trying to serialize two different objects, both of which happen to have the same value.
Unfortunately the generated SOAP message contains only one value for the object and two references
pointing to it. Is this a bug or am I missing something?

Here's how I create the two objects in Java: 

    Message msg1 = new Message("Error"); 
    Message msg2 = new Message("Error"); 

When the serialization framework encounters the second object, it thinks that it is the same
as the first one (because the hashcode function returns the same value) and hence creates
a reference to the first object:

  <msg1 href="#id8"/> 
  <msg2 href="#id8"/> 

  <multiRef id="id8" 
            soapenv:encodingStyle= <>
            xmlns:ns14=" http://test <http://test> "> 
   <text xsi:type="xsd:string">Error</text> 

I have created the Message object using WSDL2Java and it contains the equals() and hashcode()

Please help! 

Naresh Bhatia 

View raw message