cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: @ResponseWrapper usage
Date Tue, 28 Sep 2010 20:16:32 GMT

A few thoughts:

1) You may just want to switch to BARE mode where you would have complete 
control over the JAXB objects used to form the request/response.

2) Why not just return a String from the method?   
@WebReturn(name="message")
String generateResponse(..);

3) You MAY be able to do this with the wrapper like:
@XmlElement(name="message")
Response response

and then adding an @XmlValue to the message thing in the Reponse.  Not really 
sure though.

Dan


On Tuesday 28 September 2010 9:38:33 am Luc Dewavrin wrote:
> Hi,
> 
> i wanted to control the WSDL from a JAXWS webservice endpoint and used a
> ResponseWrapper in order to do that.
> I didn't like the generated WSDL since it used a wrapping "return" element
> for the type of the wsdl:part for the response
> and wanted to get rid of it.
> The response element looked like this:
> <response>
>    <return>
>       <message></message>
>     </return>
> </reponse>
> 
> All i want is a more "direct" type for the reponse without the <return>
> element.
> I thought about using a ResponseWrapper and created one:
> 
> @ResponseWrapper(className="test.ResponseWrapper")
> Response generateResponse()
> 
> The generated WSDL looks fine since the type defined in the ResponseWrapper
> is used directly (no more
> wrapping element).
> 
> Here's the content of the ReponseWrapper:
> package test;
> 
> @XmlRootElement
> @XmlType(propOrder = {"message"})
> @XmlAccessorType(XmlAccessType.FIELD)
> public class ResponseWrapper {
>      @XmlElement(name="message")
>     private String message;
>     public String getMessage() {
>          return message;
>     }
> 
>    public void setMessage(String aMessage) {
>        message=aMessage;
>    }
> 
>    public void setResponse(Response response) {
>            this.message=response.getMessage();
>    }
> 
>   public Response getResponse() {
>         return new Response(message);
>   }
> 
> }
> 
> But when i invoke the webservice i never see the <message> element. The
> field does not appear in the response.
> Maybe i don't understand the usage of the ResponseWrapper and haven't found
> much information on it .
> I added a breakpoint in the setResponse method but it's never reached.
> 
> Thanks in advance,
> Luc

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

Mime
View raw message