cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Kulp (JIRA)" <>
Subject [jira] Updated: (CXF-759) Inheritance deserialization problem
Date Fri, 06 Jul 2007 20:20:04 GMT


Daniel Kulp updated CXF-759:


This seems like it may be a problem on the .NET side.   I run Linux so I couldn't use the
.net server, but I wrote a quick CXF based server (attached a new zip file with it included)
that returns a dog.    I verified the "on the wire" with a wireshark dump and see:

<soap:Envelope xmlns:soap="">
        <getAnimalResponse xmlns="">
            <getAnimalResult xmlns:xsi="" xsi:type="Dog">

The client then does get:
Invoking getAnimal...
Color of dog: brown
Invoking getAnimals...
Number of animals returned: 1
Color of dog: brown

Thus, it looks like its working if the on the wire message is correct.   Is there anyway you
could TCPdump or otherwise capture the full on the wire message so I can check if it's actually


> Inheritance deserialization problem
> -----------------------------------
>                 Key: CXF-759
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0-RC
>         Environment: Win XP, .NET SOAP Web Service
>            Reporter: Olivier Jacquemin
>         Attachments:,
> 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="" xmlns:xsd=""
xsi:type="Dog" xmlns="">
>   <species>Dog</species>
>   <color>brown</color>
> </Animal>
> And here is the client code, added to the auto-generated file obtained from 'wsdl2java
> /**
>  * 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.

View raw message