You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Tom Davies <to...@atlassian.com> on 2008/02/13 03:48:12 UTC

Returning List via SOAP

I'm using CXF 2.0.3.

I have an interface with a method like:

     List<ReviewData> getAllReviews(@WebParam(name="token") String  
token);

The WSDL created for this method is:

<xs:element name="getAllReviews" type="tns:getAllReviews"/>
<xs:complexType name="getAllReviews">
<xs:sequence>
<xs:element minOccurs="0" name="token" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="getAllReviewsResponse"  
type="tns:getAllReviewsResponse"/>
<xs:complexType name="getAllReviewsResponse">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="return"  
type="xs:anyType"/>
</xs:sequence>
</xs:complexType>

and so the generated SOAP client returns List<Object>

Is there any way to get a return type of List<ReviewData> (the  
ReviewData class generated by wsdl2java that is, not the original  
ReviewData in the remote interface)

Thanks,
   Tom

--
ATLASSIAN - http://www.atlassian.com
Our products help over 8,500 customers in more than 95 countries to  
collaborate






Re: Returning List via SOAP

Posted by Tom Davies <to...@atlassian.com>.
On 15/02/2008, at 7:19 AM, Daniel Kulp wrote:

>
> Any chance you can try with 2.0.4?
>
> It sounds like for some reason, the ReviewData is not getting passed  
> into
> the JAXB context.   Not sure why that is..
>
> Actually, what compiler flags are you using?   With -o, I'm not sure  
> if
> the generics is compiled in.   I would assume so, but maybe not.

I was able to work around this by returning arrays instead of generic  
Lists (wsdl2java still uses generic lists in the client interfaces it  
produces)

I also encountered the problem that if one of my DTOs didn't have a  
default constructor it was silently ignored, and List<Object> used  
instead.

Tom
--
ATLASSIAN - http://www.atlassian.com
Our products help over 8,500 customers in more than 95 countries to  
collaborate






Re: Returning List via SOAP

Posted by Daniel Kulp <dk...@apache.org>.
Any chance you can try with 2.0.4?

It sounds like for some reason, the ReviewData is not getting passed into 
the JAXB context.   Not sure why that is..

Actually, what compiler flags are you using?   With -o, I'm not sure if 
the generics is compiled in.   I would assume so, but maybe not.

Dan


On Tuesday 12 February 2008, Tom Davies wrote:
> I'm using CXF 2.0.3.
>
> I have an interface with a method like:
>
>      List<ReviewData> getAllReviews(@WebParam(name="token") String
> token);
>
> The WSDL created for this method is:
>
> <xs:element name="getAllReviews" type="tns:getAllReviews"/>
> <xs:complexType name="getAllReviews">
> <xs:sequence>
> <xs:element minOccurs="0" name="token" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> <xs:element name="getAllReviewsResponse"
> type="tns:getAllReviewsResponse"/>
> <xs:complexType name="getAllReviewsResponse">
> <xs:sequence>
> <xs:element maxOccurs="unbounded" minOccurs="0" name="return"
> type="xs:anyType"/>
> </xs:sequence>
> </xs:complexType>
>
> and so the generated SOAP client returns List<Object>
>
> Is there any way to get a return type of List<ReviewData> (the
> ReviewData class generated by wsdl2java that is, not the original
> ReviewData in the remote interface)
>
> Thanks,
>    Tom
>
> --
> ATLASSIAN - http://www.atlassian.com
> Our products help over 8,500 customers in more than 95 countries to
> collaborate



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog