You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Michael Nelson <mi...@gmail.com> on 2008/03/01 14:21:11 UTC

request/response wrapper with wsdl2java

For non-trivial methods, WSDL2Java forces me to deal with request/response
wrapper classes in the client code it generates (see the 1st method as
compared to the 2nd method). Is there a way to prevent this?

Thanks,
-mike

Examples:

    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
    @WebResult(name = "getCustomerResponse", targetNamespace = "
http://customer.acme.com", partName = "parameters")
    @WebMethod
    public com.acme.customer.GetCustomerResponse getCustomer(
        @WebParam(partName = "parameters", name = "getCustomer",
targetNamespace = "http://customer.acme.com")
        GetCustomer parameters
    ) throws CustomerNotFoundFault;

    @RequestWrapper(localName = "deleteCustomer2", targetNamespace = "
http://customer.acme.com", className = "com.acme.customer.DeleteCustomer2")
    @ResponseWrapper(localName = "deleteCustomer2Response", targetNamespace
= "http://customer.acme.com", className = "
com.acme.customer.DeleteCustomer2Response")
    @WebMethod
    public void deleteCustomer2(
        @WebParam(name = "id", targetNamespace = "http://customer.acme.com")
        long id
    );

Re: request/response wrapper with wsdl2java

Posted by Daniel Kulp <dk...@apache.org>.
On Saturday 01 March 2008, Michael Nelson wrote:
> For non-trivial methods, WSDL2Java forces me to deal with
> request/response wrapper classes in the client code it generates (see
> the 1st method as compared to the 2nd method). Is there a way to
> prevent this?

Probably not.  There are very explicit rules about when we can unwrap the 
type into  the second form.   Section 2.3.1.2 of the JAX-WS spec:


(i) The operation’s input and output messages (if present) each contain 
only a single part
(ii) The input message part refers to a global element declaration whose 
localname is equal to the operation name
(iii) The output message (if present) part refers to a global element 
declaration
(iv) The elements referred to by the input and output message (if 
present) parts (henceforth referred to as wrapper elements) are both 
complex types defined using the xsd:sequence compositor 
(v) The wrapper elements only contain child elements, they MUST not 
contain other structures such as wildcards (element or attribute), 
xsd:choice, substitution groups (element references are not permitted) 
or attributes; furthermore, they MUST not be nillable.


Hope that helps explan things a bit.

Dan



>
> Thanks,
> -mike
>
> Examples:
>
>     @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>     @WebResult(name = "getCustomerResponse", targetNamespace = "
> http://customer.acme.com", partName = "parameters")
>     @WebMethod
>     public com.acme.customer.GetCustomerResponse getCustomer(
>         @WebParam(partName = "parameters", name = "getCustomer",
> targetNamespace = "http://customer.acme.com")
>         GetCustomer parameters
>     ) throws CustomerNotFoundFault;
>
>     @RequestWrapper(localName = "deleteCustomer2", targetNamespace = "
> http://customer.acme.com", className =
> "com.acme.customer.DeleteCustomer2") @ResponseWrapper(localName =
> "deleteCustomer2Response", targetNamespace =
> "http://customer.acme.com", className = "
> com.acme.customer.DeleteCustomer2Response")
>     @WebMethod
>     public void deleteCustomer2(
>         @WebParam(name = "id", targetNamespace =
> "http://customer.acme.com") long id
>     );



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

RE: request/response wrapper with wsdl2java

Posted by Daniel Lipofsky <Da...@bricsnet.com>.
First try and read the section in this wiki titled
"How can I switch my generated web service method calls
from wrapper style to non wrapper-style (or vice-versa)?"
http://cwiki.apache.org/confluence/display/CXF20DOC/WSDL+to+Java 

and the related section referenced in the JAX-WS 2.1 specification.

That being said I didn't have too much luck with the
enableWrapperStyle flag.  Instead I am controlling it with
the naming convention - which is case sensitive.  So if I
name the operation "GetObjects" vesus "getObjects" it
changes style from wrapped to unwrapped (either way the
generated java method is called "getObjects").

- Dan


> -----Original Message-----
> From: Michael Nelson [mailto:mikenel@gmail.com] 
> Sent: Saturday, March 01, 2008 6:21 AM
> To: cxf-user@incubator.apache.org
> Subject: request/response wrapper with wsdl2java
> 
> For non-trivial methods, WSDL2Java forces me to deal with 
> request/response
> wrapper classes in the client code it generates (see the 1st method as
> compared to the 2nd method). Is there a way to prevent this?
> 
> Thanks,
> -mike
> 
> Examples:
> 
>     @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>     @WebResult(name = "getCustomerResponse", targetNamespace = "
> http://customer.acme.com", partName = "parameters")
>     @WebMethod
>     public com.acme.customer.GetCustomerResponse getCustomer(
>         @WebParam(partName = "parameters", name = "getCustomer",
> targetNamespace = "http://customer.acme.com")
>         GetCustomer parameters
>     ) throws CustomerNotFoundFault;
> 
>     @RequestWrapper(localName = "deleteCustomer2", targetNamespace = "
> http://customer.acme.com", className = 
> "com.acme.customer.DeleteCustomer2")
>     @ResponseWrapper(localName = "deleteCustomer2Response", 
> targetNamespace
> = "http://customer.acme.com", className = "
> com.acme.customer.DeleteCustomer2Response")
>     @WebMethod
>     public void deleteCustomer2(
>         @WebParam(name = "id", targetNamespace = 
> "http://customer.acme.com")
>         long id
>     );
>