[ https://issues.apache.org/jira/browse/CXF-759?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Kulp updated CXF-759:
----------------------------
Attachment: CxfInheritancePb_070607.zip
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="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getAnimalResponse xmlns="http://tempuri.org/">
<getAnimalResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Dog">
<species>Dog</species>
<color>brown</color>
</getAnimalResult>
</getAnimalResponse>
</soap:Body>
</soap:Envelope>
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
OK?
Dan
> 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
>
>
> 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.