Search code examples
web-serviceswsdljax-wsw3c

How to generate WSDL 2.0 with JAX-WS


This questions may be silly but I haven't found a way to get a WSDL 2.0 generated by a JAX-WS RI Web service.

I've been using the latest jax-ws version and if I create a very simple WS (such as the example below), the generated WSDL will be version 1.1.

    @WebService
    public interface RandomNumberGenerator {

        Integer getRandomNumber();

    }

    @WebService(endpointInterface="RandomNumberGenerator")
    public class RandomNumberGeneratorImpl {

       public Integer getRandomNumber() {
            return (int) (Math.random() * 1000);
       }    
    }

Does anyone know how I explicitly tell JAX-WS to generate a WSDL 2.0? Considering 2.0 is the W3C recommendation since 2007, I'm pretty confident JAX-WS does offer a way to generate it.

Thanks.


Solution

  • I'm pretty confident JAX-WS does offer a way to generate it.

    I'm afraid, it does not. To quote from the JAX-WS 2.0 specification, page 2, section Goals:

    WSDL 2.0: The W3C is expected to progress WSDL 2.0[11] to Recommendation during the lifetime of this JSR. JAX-WS 2.0 will add support for WSDL 2.0 whilst requiring continued support for WSDL 1.1. Note: The expert group for the JSR decided against this goal for this release . We will look at adding support in a future revision of the JAX-WS specification.

    This means that there will be no WSDL 2.0 support in JAX-WS 2.0 which is why the reference implementation does not provide it. Afaik, there is not much advance in this area at the moment.

    If you want WSDL 2.0 along JAX-WS, you will have to use another stack, such as Axis2.