cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olivier Jacquemin (JIRA)" <j...@apache.org>
Subject [jira] Updated: (CXF-759) Inheritance deserialization problem
Date Mon, 09 Jul 2007 06:05:04 GMT

     [ https://issues.apache.org/jira/browse/CXF-759?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Olivier Jacquemin updated CXF-759:
----------------------------------

    Attachment: ZooDump.zip

Hi Daniel,

Here is a Wireshark dump corresponding to the source code sent previously, except that the
client used the "ZooSoap" port instead of the "ZooSoap12" port.
ZooSoapClient.java, line 47: 
        ZooSoap port = ss.getZooSoap();

>From the dump, here is the response to the getAnimal() method invocation:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <getAnimalResponse xmlns="http://tempuri.org/">
      <getAnimalResult xsi:type="Dog">
        <species>Dog</species>
        <color>brown</color>
      </getAnimalResult>
    </getAnimalResponse>
  </soap:Body>
</soap:Envelope>

This is *very* similar to the one you used...
As I understand it, "trunk" means the current development branch: is this correct?  I'll try
to get and compile the latest sources to see if this issue is fixed there.

> Inheritance deserialization problem
> -----------------------------------
>
>                 Key: CXF-759
>                 URL: https://issues.apache.org/jira/browse/CXF-759
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0-RC
>         Environment: Win XP, .NET SOAP Web Service
>            Reporter: Olivier Jacquemin
>         Attachments: CxfInheritancePb.zip, CxfInheritancePb_070607.zip, ZooDump.zip
>
>
> I am currently in the process of selecting a mechanism for building a java client for
a SOAP Web Services API developed in .NET.  This API is fairly simple, except for a point:
some data structures returned are relatively complex and involve inheritance.
> In this case, these object structures don't seem to be correctly deserialized.
> A detailed description follows: if anyone could help me either
> - improving the deserialization process in Cxf, or
> - obtaining a way to access the raw XML data (or the corresponding parsed object structure)
returned, so that the client application can complete the deserialization process itself in
an "ad hoc" way,
> I would very much appreciate it.
> Here is a very simple example after reducing the problem to its simplest form.
> /**
>  * Web service code
>  * C#
>  */
> [WebMethod]
> [XmlInclude(typeof(Dog))]
> [SoapInclude(typeof(Dog))]
> public Animal getAnimal()
> {
>     return new Dog("brown");
> }
> public class Animal // ...
> public class Dog : Animal // ...
> Here is the XML contained in the response to the invocation of getAnimal(): the xsi:type="Dog"
indicates that an instance of the daughter class is returned:
> <?xml version="1.0" encoding="utf-8"?>
> <Animal xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:type="Dog" xmlns="http://tempuri.org/">
>   <species>Dog</species>
>   <color>brown</color>
> </Animal>
> And here is the client code, added to the auto-generated file obtained from 'wsdl2java
-client':
> /**
>  * Client code
>  * Java
>  */
> org.tempuri.Dog dog = null;
> System.out.println("Invoking getAnimal...");
> org.tempuri.Animal animal = port.getAnimal();
> try {
>     dog = (Dog)animal;
> }
> catch (java.lang.ClassCastException e1) {
>     e1.printStackTrace();
> }
> if (dog != null) {
>     System.out.println("Color of dog: " + dog.color);
> }
> The trouble is that the cast from Animal (parent class) to Dog (daughter class) fails:
a ClassCastException is thrown.
> Many thanks for any help on this issue,
>     _Olivier_

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message