[ 
http://issues.apache.org/jira/browse/AXIS-2285?page=comments#action_12356845 ] 

Geir Egil Hansen commented on AXIS-2285:
----------------------------------------

Maybe you are right about that Tom ("changing the contract").

However, most of the clients I tried does not complain when adding a new 
datamember to the class.
So far only Axis client code does.

What is the rest of the problem?

> Deserializing objects on client side with unknown data members from server 
> side causes exception, makes server code harder to maintain
> --------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: AXIS-2285
>          URL: http://issues.apache.org/jira/browse/AXIS-2285
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.3
>  Environment: Windows XP
>     Reporter: Geir Egil Hansen

>
> Example: 
> I make a class on the server side. The class contains some data members.
> Like 
> class MyClass{
>    String str1;
> }
> Some clients are generated uses the WSDL file. 
> In the next server version I need to add another datamember to the class:
> class MyClass{
>    String str1;
>    String str2;
> }
> Then the Axis client based on the previous version throws an exception. The 
> exception is thrown from the class BeanDeserializer at around line 250. And 
> the code doing it is like this:
>       if (propDesc == null) {
>               throw new SAXException( Messages.getMessage("badElem00", 
> javaType.getName(),   localName));
>               return null;
>       }
> Throwing an exception here in the client makes it impossible to extend the 
> functionality on the server side. I have tested .NET clients, other Java 
> clients, Borland  C++ Builder and none of them throws any exception. And I 
> think it is wrong to throw any here, because the client code is supposed to 
> deserialize any datamembers it knwos about. It does need what it does not 
> know anything about. It would be a different matter if an existing datameber 
> was removed in the new version (like str1 was removed in the example). THEN 
> an exception must be thrown.
> I think this is a bug and should be fixed. Now we ask our customers  if they 
> are to use Axis to generate the client, and if they are, we give them a new 
> version of the BeanSerializer.java where the code is changed to
>       if (propDesc == null) {
>                       //@TODO: No such field. Throwing exception here makes 
> code not backwards compatible.
>                       log.warn("No such field in client code: " + 
> javaType.getName() + "/" + localName);
> //            throw new SAXException(
> //                    Messages.getMessage("badElem00", javaType.getName(),
> //                                         localName));
>                       return null;
>               }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to