You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Daniel Wood <Da...@rdfgroup.com> on 2008/05/06 13:46:11 UTC

cxf and abstract object transformation

I'm currently developing an app (using CXF 2.06 for the ws interaction)
and have come across an issue when transforming data from an external
web service back into Java. It looks like CXF is trying to create the
abstract version of the object, rather than the concrete implementation
(see stack trace at the end of this message). Is there any way I can
help CXF identify this data with the correct implementation of the
object through code?

 

Thanks,

Daniel

 

com.sun.xml.ws.encoding.soap.DeserializationException: Failed to read a
response: javax.xml.bind.UnmarshalException

 - with linked exception:

[javax.xml.bind.UnmarshalException: Unable to create an instance of
com.xxx.party.Party

 - with linked exception:

[java.lang.InstantiationException]]



This transmission is confidential and intended solely for the person or organisation to whom it is addressed. It may contain privileged and confidential information. If you are not the intended recipient, you should not copy, distribute or take any action in reliance on it. If you have received this transmission in error, please notify the sender immediately. All messages passing through this gateway are virus scanned. Any opinions or advice contained in this e-mail are those of the individual sender except where they are stated to be the views of RDF Group plc or its subsidiaries, RDF Consulting (registered number 3522265), RDF Resources (3984500) and Aqua Resources Group (4975898). RDF Group plc is registered in England at 2 Bartholomews, Brighton, BN1 1HG (registered number 3637683).

RE: cxf and abstract object transformation

Posted by Daniel Wood <Da...@rdfgroup.com>.
Ian, 
thanks for the assistance. As I am using the generated @WebServiceClient
classes to call the web services (rather than using a client), is there
a simple way to add this functionality in without changing the way I
access the external services? Also, what are the advantages of using a
client as opposed to calling the generated @WebServiceClient class
directly?

Thanks again,
Daniel


-----Original Message-----
From: Ian Roberts [mailto:i.roberts@dcs.shef.ac.uk] 
Sent: 06 May 2008 14:36
To: users@cxf.apache.org
Subject: Re: cxf and abstract object transformation

Daniel Wood wrote:
> I'm currently developing an app (using CXF 2.06 for the ws
interaction)
> and have come across an issue when transforming data from an external
> web service back into Java. It looks like CXF is trying to create the
> abstract version of the object, rather than the concrete
implementation
> (see stack trace at the end of this message). Is there any way I can
> help CXF identify this data with the correct implementation of the
> object through code?

There was a post about this a couple of weeks back - in order to pass 
objects of types that are not directly used as parameter or return 
types, you need to tell the JAXB context about the subclasses
explicitly.

http://www.nabble.com/problem-serializing-class-hierarchy-tt16795656.htm
l

With CXF 2.1 you can just use @XmlSeeAlso, but it's a bit more 
complicated with 2.0.x.

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK


This transmission is confidential and intended solely for the person or organisation to whom it is addressed. It may contain privileged and confidential information. If you are not the intended recipient, you should not copy, distribute or take any action in reliance on it. If you have received this transmission in error, please notify the sender immediately. All messages passing through this gateway are virus scanned. Any opinions or advice contained in this e-mail are those of the individual sender except where they are stated to be the views of RDF Group plc or its subsidiaries, RDF Consulting (registered number 3522265), RDF Resources (3984500) and Aqua Resources Group (4975898). RDF Group plc is registered in England at 2 Bartholomews, Brighton, BN1 1HG (registered number 3637683).

RE: cxf and abstract object transformation

Posted by Daniel Wood <Da...@rdfgroup.com>.
Thanks for the help I have this working now.

Daniel 

-----Original Message-----
From: Ian Roberts [mailto:i.roberts@dcs.shef.ac.uk] 
Sent: 06 May 2008 14:36
To: users@cxf.apache.org
Subject: Re: cxf and abstract object transformation

Daniel Wood wrote:
> I'm currently developing an app (using CXF 2.06 for the ws
interaction)
> and have come across an issue when transforming data from an external
> web service back into Java. It looks like CXF is trying to create the
> abstract version of the object, rather than the concrete
implementation
> (see stack trace at the end of this message). Is there any way I can
> help CXF identify this data with the correct implementation of the
> object through code?

There was a post about this a couple of weeks back - in order to pass 
objects of types that are not directly used as parameter or return 
types, you need to tell the JAXB context about the subclasses
explicitly.

http://www.nabble.com/problem-serializing-class-hierarchy-tt16795656.htm
l

With CXF 2.1 you can just use @XmlSeeAlso, but it's a bit more 
complicated with 2.0.x.

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK


This transmission is confidential and intended solely for the person or organisation to whom it is addressed. It may contain privileged and confidential information. If you are not the intended recipient, you should not copy, distribute or take any action in reliance on it. If you have received this transmission in error, please notify the sender immediately. All messages passing through this gateway are virus scanned. Any opinions or advice contained in this e-mail are those of the individual sender except where they are stated to be the views of RDF Group plc or its subsidiaries, RDF Consulting (registered number 3522265), RDF Resources (3984500) and Aqua Resources Group (4975898). RDF Group plc is registered in England at 2 Bartholomews, Brighton, BN1 1HG (registered number 3637683).

Re: cxf and abstract object transformation

Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
Daniel Wood wrote:
> I'm currently developing an app (using CXF 2.06 for the ws interaction)
> and have come across an issue when transforming data from an external
> web service back into Java. It looks like CXF is trying to create the
> abstract version of the object, rather than the concrete implementation
> (see stack trace at the end of this message). Is there any way I can
> help CXF identify this data with the correct implementation of the
> object through code?

There was a post about this a couple of weeks back - in order to pass 
objects of types that are not directly used as parameter or return 
types, you need to tell the JAXB context about the subclasses explicitly.

http://www.nabble.com/problem-serializing-class-hierarchy-tt16795656.html

With CXF 2.1 you can just use @XmlSeeAlso, but it's a bit more 
complicated with 2.0.x.

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK