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

Dan Diephouse commented on CXF-759:
-----------------------------------

I was able to get your code to work if I added this to the code:

Client client = ClientProxy.getClient(port);
HTTPConduit c = (HTTPConduit) client.getConduit();
c.getClient().setAllowChunking(false);

This is why I've advocated disabling chunking by default... But there are a 
couple other important differences:

1. I'm using VS 2005 and you're using an older version
2. I was getting a different exception than you - for some reason the service 
was giving an HTTP 400 response

Can you try the above code? I'm sort of doubtful it will fix your problem 
though...  yet, my web service response seems to be the exact same as yours.

> 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.

Reply via email to