3

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?

Yishai
  • 90,445
  • 31
  • 189
  • 263

1 Answers1

1

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.

Community
  • 1
  • 1
Vineet Reynolds
  • 76,006
  • 17
  • 150
  • 174
  • For EJB3, the link to JBWS-2206 did the trick. It is rather surprising that you have to reference the META-INF, but that was the hidden secret I hadn't guessed. – Yishai Sep 06 '09 at 15:33
  • Yea, there are a lot of things that in JAX-WS that are not obvious at first sight. If you encounter a similar case, download a copy of the JAX-WS 2.0/2.1 specifications. – Vineet Reynolds Sep 06 '09 at 16:33
  • By the way, in this case, the JAX-WS 2.0 spec says - **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”)** – Vineet Reynolds Sep 06 '09 at 16:35
  • Ah, but relative to what? I saw that, but META-INF isn't relative to anything obvious. JBoss' interpretation is reasonable, I guess, but not obvious. – Yishai Sep 06 '09 at 16:38
  • Yes, that's right. META-INF is not defined in the spec as the location. – Vineet Reynolds Sep 06 '09 at 16:41
  • And leaving that location to the JAX-WS implementation is a bit foolhardy. There's nothing preventing IBM WAS (the only JAX-WS provider that does not use Metro) from asking developers to put WSDLs in META-INF\jaxws\ or the like. – Vineet Reynolds Sep 06 '09 at 16:43
  • Vinnet, any insight into this question? http://stackoverflow.com/questions/1369624/jboss-4-2-2-web-service-soapaddress – Yishai Sep 06 '09 at 16:53
  • Looks interesting, will give it a shot. – Vineet Reynolds Sep 06 '09 at 17:01