JAX-WS and @XmlRootElement

Just finished a fight with JAX-WS. It turns out that if I have a method like this:

@WebService(targetNamespace=...)
@SOAPBinding(parameterStyle = SOAPBINDING.ParameterStyle.BARE /* don't ask */)
class MyWebService
{
    @WebMethod
    MyClass getMyStuff();
}

then generated WSDL depends on whether NyClass has @XmlRootElement annotation. If it does, you’re going to have a WSDL with empty input (client sends empty SOAP body with no indication of request kind whatsoever). If it does not, then everything is OK, request body is not empty.

I am sure there is a simple, logical explanation to all this…

Leave a Reply

Your email address will not be published. Required fields are marked *