poussma
poussma

Reputation: 7311

JAXB, WSDL and RequestWrapper / ResponseWrapper

I want my generated classes to use the "wrapped style" elements like this (using @RequestWrapper and @ResponseWrapper

@WebMethod(action = "http://.../IsThatServiceAvailable")
@RequestWrapper(localName = "isThatServiceAvailable", targetNamespace = "http://...", className = "....IsThatServiceAvailable")
@ResponseWrapper(localName = "isThatServiceAvailableResponse", targetNamespace = "http://...", className = "....IsThatServiceAvailableResponse")
@WebResult(name = "isAvailable", targetNamespace = "")
public boolean isThatServiceAvailable(
    @WebParam(name = "context", targetNamespace = "")
    ...Context context
) throws WSException;

But I cannot guess neither find a documentation that explains when it is used or not. There is definitely something related to the naming of the operation and of the parameters name or type because the behavior is different when I use lower case camel humps or upper case camel hums... but I cannot figure out what (I have tried to reproduce the scheme I thought for another operation but it does not work).

Could you please give me the rules ?

Upvotes: 0

Views: 2725

Answers (1)

poussma
poussma

Reputation: 7311

Here is what I found in the JAX WS documentation : https://jcp.org/aboutJava/communityprocess/pfd/jsr224/index.html (§2.3.1.2 Wrapper Style)

A WSDL operation qualifies for wrapper style mapping only if the following criteria are met:

(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 part refers to a global element declaration

(iv) The elements referred to by the input and output message 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.

Note: in my case, (iv) rule was not respected

Upvotes: 1

Related Questions