How to create WSDL 2.0 using JAX-WS

These questions may be silly, but I did not find a way to get the WSDL 2.0 created by the JAX-WS RI web service.

I am using the latest version of jax-ws, and if I create a very simple WS (like 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 create WSDL 2.0? Given the 2.0 recommendation of the W3C since 2007, I am sure that JAX-WS offers a way to generate it.

Thanks.

+6
source share
1 answer

I am sure that JAX-WS offers a way to generate it.

I am afraid it is not. To quote the JAX-WS 2.0 specification , page 2, section Objectives:

WSDL 2.0: The W3C is expected to promote WSDL 2.0 [11] to the Recommendation during the lifetime of this JSR. JAX-WS 2.0 will add support for WSDL 2.0, requiring ongoing support for WSDL 1.1. Note. The expert group for JSR decided to abandon this goal for this version. We will look at adding support to a future revision of the JAX-WS specification.

This means that JAX-WS 2.0 will not support WSDL 2.0, so the reference implementation does not provide it. Afaik, at the moment there are not many in this area.

If you need WSDL 2.0 over JAX-WS, you will have to use a different stack, such as Axis2 .

+9
source

All Articles