You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Philipp Schill <ps...@cordys.com> on 2008/09/16 16:48:50 UTC

Question on inheritance

Hello,

i want to use cxf to provide a webservice with complex data types:

@WebMethod(action = "lookupPerson")
List<Person> lookupPerson(@WebParam (name  = "person") Person person) throws InternalException, BackendException;

Person is an Object with some Parameters.
Person has also a subclass SpecialPerson.

How do I have to annotate the WebMethod to get a SpecialPerson back in case it is a SpecialPerson. I always get a Person back.

Are there any examples with complex data types and inheritance?

Thanks and regards
philipp

________________________________
The information contained in this communication is confidential, intended solely for the use of the individual or entity to whom it is addressed and may be legally privileged and protected by professional secrecy. Access to this message by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it is prohibited and may be unlawful. Please immediately contact the sender if you have received this message in error. This email does not constitute any commitment from Cordys Holding BV or any of its subsidiaries except when expressly agreed in a written agreement between the intended recipient and Cordys Holding BV or its subsidiaries. Cordys is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. Cordys does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. If you are not the intended recipient of this communication please return the communication to the sender and delete and destroy all copies.

RE: Newbie question on running the CXF Samples in Eclipse

Posted by Gr...@emc.com.
Ok, classpath incorrectly set up, this is what was tripping me up.



-----Original Message-----
From: Graham_Steveg@emc.com [mailto:Graham_Steveg@emc.com] 
Sent: Tuesday, September 16, 2008 1:24 PM
To: users@cxf.apache.org
Subject: RE: Newbie question on running the CXF Samples in Eclipse

I am not even getting close to that step.

I am trying to run
\samples\jax_rs\basic\src\demo\jaxrs\client\Client.java

When I attempt to "Run as >> Java Application", I get a dialog saying,
"Selection does not contain a main type"

"Debug as >> Java Application" gives the same result.

Like I said, I suspect it is something really simple that I am missing.

sgg

-----Original Message-----
From: Ostermueller, Erik [mailto:Erik.Ostermueller@fnis.com] 
Sent: Tuesday, September 16, 2008 12:25 PM
To: users@cxf.apache.org
Subject: RE: Newbie question on running the CXF Samples in Eclipse

Use eclipse to start tomcat.
Then, put breakpoints in your client and/or server code.
>From inside eclipse, run the client.
It should stop at the breakpoints you've set. 

-----Original Message-----
From: Graham_Steveg@emc.com [mailto:Graham_Steveg@emc.com] 
Sent: Tuesday, September 16, 2008 11:22 AM
To: users@cxf.apache.org
Subject: Newbie question on running the CXF Samples in Eclipse

Help please.

I installed CXF on my machine, and am successful in running the samples
from the command line.
Now I want to see these samples running in Eclipse.  But I am somewhat
stuck (likely due to something simple).

I installed Eclipse (Ganymede) with the SOA Tools Project.
I set up the CXF runtime in eclipse according to
http://cwiki.apache.org/CXF20DOC/cxfeclipseplugininstructions.html.

I installed Tomcat and set up the server as specified in
http://cwiki.apache.org/CXF20DOC/cxfeclipseplugininstructions.html

I created a new project and imported the samples directory from the CXF
install directory.

But now comes the really newbie question: "what else do I need to do in
order to actually run or execute any of these samples in the eclipse
environment?  How do I actually run (or debug) one of these sample
applications?".

Thanks in advance

sgg

_____________

The information contained in this message is proprietary and/or
confidential. If you are not the 
intended recipient, please: (i) delete the message and all copies; (ii)
do not disclose, 
distribute or use the message in any manner; and (iii) notify the sender
immediately. In addition, 
please be aware that any message addressed to our domain is subject to
archiving and review by 
persons other than the intended recipient. Thank you.
_____________



RE: Newbie question on running the CXF Samples in Eclipse

Posted by Gr...@emc.com.
I am not even getting close to that step.

I am trying to run
\samples\jax_rs\basic\src\demo\jaxrs\client\Client.java

When I attempt to "Run as >> Java Application", I get a dialog saying,
"Selection does not contain a main type"

"Debug as >> Java Application" gives the same result.

Like I said, I suspect it is something really simple that I am missing.

sgg

-----Original Message-----
From: Ostermueller, Erik [mailto:Erik.Ostermueller@fnis.com] 
Sent: Tuesday, September 16, 2008 12:25 PM
To: users@cxf.apache.org
Subject: RE: Newbie question on running the CXF Samples in Eclipse

Use eclipse to start tomcat.
Then, put breakpoints in your client and/or server code.
>From inside eclipse, run the client.
It should stop at the breakpoints you've set. 

-----Original Message-----
From: Graham_Steveg@emc.com [mailto:Graham_Steveg@emc.com] 
Sent: Tuesday, September 16, 2008 11:22 AM
To: users@cxf.apache.org
Subject: Newbie question on running the CXF Samples in Eclipse

Help please.

I installed CXF on my machine, and am successful in running the samples
from the command line.
Now I want to see these samples running in Eclipse.  But I am somewhat
stuck (likely due to something simple).

I installed Eclipse (Ganymede) with the SOA Tools Project.
I set up the CXF runtime in eclipse according to
http://cwiki.apache.org/CXF20DOC/cxfeclipseplugininstructions.html.

I installed Tomcat and set up the server as specified in
http://cwiki.apache.org/CXF20DOC/cxfeclipseplugininstructions.html

I created a new project and imported the samples directory from the CXF
install directory.

But now comes the really newbie question: "what else do I need to do in
order to actually run or execute any of these samples in the eclipse
environment?  How do I actually run (or debug) one of these sample
applications?".

Thanks in advance

sgg

_____________

The information contained in this message is proprietary and/or
confidential. If you are not the 
intended recipient, please: (i) delete the message and all copies; (ii)
do not disclose, 
distribute or use the message in any manner; and (iii) notify the sender
immediately. In addition, 
please be aware that any message addressed to our domain is subject to
archiving and review by 
persons other than the intended recipient. Thank you.
_____________


RE: Newbie question on running the CXF Samples in Eclipse

Posted by "Ostermueller, Erik" <Er...@fnis.com>.
Use eclipse to start tomcat.
Then, put breakpoints in your client and/or server code.
>From inside eclipse, run the client.
It should stop at the breakpoints you've set. 

-----Original Message-----
From: Graham_Steveg@emc.com [mailto:Graham_Steveg@emc.com] 
Sent: Tuesday, September 16, 2008 11:22 AM
To: users@cxf.apache.org
Subject: Newbie question on running the CXF Samples in Eclipse

Help please.

I installed CXF on my machine, and am successful in running the samples
from the command line.
Now I want to see these samples running in Eclipse.  But I am somewhat
stuck (likely due to something simple).

I installed Eclipse (Ganymede) with the SOA Tools Project.
I set up the CXF runtime in eclipse according to
http://cwiki.apache.org/CXF20DOC/cxfeclipseplugininstructions.html.

I installed Tomcat and set up the server as specified in
http://cwiki.apache.org/CXF20DOC/cxfeclipseplugininstructions.html

I created a new project and imported the samples directory from the CXF
install directory.

But now comes the really newbie question: "what else do I need to do in
order to actually run or execute any of these samples in the eclipse
environment?  How do I actually run (or debug) one of these sample
applications?".

Thanks in advance

sgg

_____________

The information contained in this message is proprietary and/or confidential. If you are not the 
intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, 
distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, 
please be aware that any message addressed to our domain is subject to archiving and review by 
persons other than the intended recipient. Thank you.
_____________

Newbie question on running the CXF Samples in Eclipse

Posted by Gr...@emc.com.
Help please.

I installed CXF on my machine, and am successful in running the samples
from the command line.
Now I want to see these samples running in Eclipse.  But I am somewhat
stuck (likely due to something simple).

I installed Eclipse (Ganymede) with the SOA Tools Project.
I set up the CXF runtime in eclipse according to
http://cwiki.apache.org/CXF20DOC/cxfeclipseplugininstructions.html.

I installed Tomcat and set up the server as specified in
http://cwiki.apache.org/CXF20DOC/cxfeclipseplugininstructions.html

I created a new project and imported the samples directory from the CXF
install directory.

But now comes the really newbie question: "what else do I need to do in
order to actually run or execute any of these samples in the eclipse
environment?  How do I actually run (or debug) one of these sample
applications?".

Thanks in advance

sgg

RE: Question on inheritance

Posted by Philipp Schill <ps...@cordys.com>.
thank you for your hint. I already did this. The input parameters seem to be okay and they are inserted correctly into the WSDL.
I have the problem with the return values.

If I simply use the Person.class as a return value, I get an element <return> with xsi:type="ns2:specialperson" back.
My client is not able to get access to the elements of this return value.

Now I did an annotation with

@RequestWrapper(className = "mypackage.Person")
@ResponseWrapper(className = "maypackage.Person")

The return value in the WSDL seems now to be right.

Here I have then the problem, that the input parameter of List<Person> lookupPerson(@WebParam (name  = "person") Person person) is always null.
If I set a breakpoint and fill the input parameter, all works fine.

Is this a bug, that my input is always getting lost?

Thanks
phil


-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org]
Sent: Dienstag, 16. September 2008 17:55
To: users@cxf.apache.org
Cc: Philipp Schill
Subject: Re: Question on inheritance


Assuming you are using CXF 2.1.x (and not 2.0.x), the easiest thing to do is
to add an @XmlSeeAlso(SpecialPerson.class) annotation to the interface.
That allows the JAXB runtime to see the subclass so you'll get it properly
written out (with the xsi:type) and can then be properly read as well.

Dan


On Tuesday 16 September 2008 10:48:50 am Philipp Schill wrote:
> Hello,
>
> i want to use cxf to provide a webservice with complex data types:
>
> @WebMethod(action = "lookupPerson")
> List<Person> lookupPerson(@WebParam (name  = "person") Person person)
> throws InternalException, BackendException;
>
> Person is an Object with some Parameters.
> Person has also a subclass SpecialPerson.
>
> How do I have to annotate the WebMethod to get a SpecialPerson back in case
> it is a SpecialPerson. I always get a Person back.
>
> Are there any examples with complex data types and inheritance?
>
> Thanks and regards
> philipp
>
> ________________________________
> The information contained in this communication is confidential, intended
> solely for the use of the individual or entity to whom it is addressed and
> may be legally privileged and protected by professional secrecy. Access to
> this message by anyone else is unauthorized. If you are not the intended
> recipient, any disclosure, copying, or distribution of the message, or any
> action or omission taken by you in reliance on it is prohibited and may be
> unlawful. Please immediately contact the sender if you have received this
> message in error. This email does not constitute any commitment from Cordys
> Holding BV or any of its subsidiaries except when expressly agreed in a
> written agreement between the intended recipient and Cordys Holding BV or
> its subsidiaries. Cordys is neither liable for the proper and complete
> transmission of the information contained in this communication nor for any
> delay in its receipt. Cordys does not guarantee that the integrity of this
> communication has been maintained nor that the communication is free of
> viruses, interceptions or interference. If you are not the intended
> recipient of this communication please return the communication to the
> sender and delete and destroy all copies.



--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

The information contained in this communication is confidential, intended solely for the use of the individual or entity to whom it is addressed and may be legally privileged and protected by professional secrecy. Access to this message by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it is prohibited and may be unlawful. Please immediately contact the sender if you have received this message in error. This email does not constitute any commitment from Cordys Holding BV or any of its subsidiaries except when expressly agreed in a written agreement between the intended recipient and Cordys Holding BV or its subsidiaries. Cordys is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. Cordys does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. If you are not the intended recipient of this communication please return the communication to the sender and delete and destroy all copies.

Re: Question on inheritance

Posted by Daniel Kulp <dk...@apache.org>.
Assuming you are using CXF 2.1.x (and not 2.0.x), the easiest thing to do is 
to add an @XmlSeeAlso(SpecialPerson.class) annotation to the interface.   
That allows the JAXB runtime to see the subclass so you'll get it properly 
written out (with the xsi:type) and can then be properly read as well.

Dan


On Tuesday 16 September 2008 10:48:50 am Philipp Schill wrote:
> Hello,
>
> i want to use cxf to provide a webservice with complex data types:
>
> @WebMethod(action = "lookupPerson")
> List<Person> lookupPerson(@WebParam (name  = "person") Person person)
> throws InternalException, BackendException;
>
> Person is an Object with some Parameters.
> Person has also a subclass SpecialPerson.
>
> How do I have to annotate the WebMethod to get a SpecialPerson back in case
> it is a SpecialPerson. I always get a Person back.
>
> Are there any examples with complex data types and inheritance?
>
> Thanks and regards
> philipp
>
> ________________________________
> The information contained in this communication is confidential, intended
> solely for the use of the individual or entity to whom it is addressed and
> may be legally privileged and protected by professional secrecy. Access to
> this message by anyone else is unauthorized. If you are not the intended
> recipient, any disclosure, copying, or distribution of the message, or any
> action or omission taken by you in reliance on it is prohibited and may be
> unlawful. Please immediately contact the sender if you have received this
> message in error. This email does not constitute any commitment from Cordys
> Holding BV or any of its subsidiaries except when expressly agreed in a
> written agreement between the intended recipient and Cordys Holding BV or
> its subsidiaries. Cordys is neither liable for the proper and complete
> transmission of the information contained in this communication nor for any
> delay in its receipt. Cordys does not guarantee that the integrity of this
> communication has been maintained nor that the communication is free of
> viruses, interceptions or interference. If you are not the intended
> recipient of this communication please return the communication to the
> sender and delete and destroy all copies.



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog