Javax.jws.WebService.wsdlLocation with jboss 4.2.2

javajbossweb serviceswsdl

How specifically can you use the javax.jws.WebService.wsdlLocation in JBoss 4.2.2? (This is for an EJB3 bean deployed as a web service).

There is some documentation around that it is supported, but what exactly is the format? I have tried an http, I have tried a relative URL. How does JBoss look for it, a URL, something on the classpath of the EJB, something else?

Best Answer

You should take a look at JBWS-2206 and related issues JBWS-1714 and JBWS-1837.

From the information I could gather, JBoss internally uses Metro (the RI) for JAX-WS. I'm not very sure about this, but it appears that Metro reads WSDLs, if provided via the wsdllocation attribute, using the classloader, thereby making META-INF/wsdl of the EJB JAR a safe choice to place WSDLs. The example file in JBWS-2206 would help as a reference.

Update

A thorough overview on how to provide your own WSDL is present in the JBoss forums.

Update #2

The JAX-WS specification, gives a better idea on why this is the case. In the section 5.2.5.3 Use of @WebService(wsdlLocation) and Metadata, one can find the specification stating that

The value of the wsdlLocation annotation element on an endpoint implementation class, if any, MUST be a relative URL. The document it points to MUST be packaged with the application. Moreover, it MUST follow the requirements in section 5.2.5.4 below (”Application-specified Service”).

Furthermore, it states that

A JAX-WS implementation MUST patch the location attributes of all wsdl:import and xsd:import statement in local documents that point to local documents. An implementation MUST NOT patch any other location attributes.

defining how the generated WSDL should appear.