You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Dan Diephouse (JIRA)" <ji...@apache.org> on 2007/07/11 04:29:04 UTC
[jira] Closed: (CXF-759) Inheritance deserialization problem
[ https://issues.apache.org/jira/browse/CXF-759?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dan Diephouse closed CXF-759.
-----------------------------
Resolution: Cannot Reproduce
Chunking should be enabled by default, so I don't know why it would hang. If you send along a WSDL (in a new JIRA issue), we'll take a look though.
> 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
> Assignee: Dan Diephouse
> 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.