axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Jordahl <t...@macromedia.com>
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
Macromedia
 
-----Original Message-----
From: Naresh Bhatia [mailto:NBhatia@sapient.com]
Sent: Tuesday, July 02, 2002 12:00 PM
To: 'axis-dev@xml.apache.org'
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.
 
Thanks.
Naresh Bhatia
 
-----Original Message-----
From: Naresh Bhatia [mailto:NBhatia@sapient.com]
Sent: Saturday, June 29, 2002 1:17 PM
To: 'axis-user@xml.apache.org'
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" 
            SOAP-ENC:root="0" 
            soapenv:encodingStyle= http://schemas.xmlsoap.org/soap/encoding/ <http://schemas.xmlsoap.org/soap/encoding/>
 
            xsi:type="ns14:Message" 
            xmlns:ns14=" http://test <http://test> "> 
   <text xsi:type="xsd:string">Error</text> 
  </multiRef> 

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

Please help! 

Naresh Bhatia 


Mime
View raw message