Java – Has anyone gotten jax-ws-catalog.xml to resolve schemaLocation locally on Metro

javajava-metro-frameworkjax-ws

I have added a jax-ws-catalog.xml to my .war file in order to resolve the schemaLocation locally instead of remotely in . I've followed the example at

Metro User Guide: 2.10. Developing client application with locally packaged WSDL

When I deploy the .war and use soapUI to validate the web service it gets stuck trying to access the schemaLocation http://somehost:8080/CMDB/schemas/common/1.0/CMDBCommonTypes.xsd

The schema and wsdl both validate in Eclipse (using XML Catalog tool for Eclipse). (I can post the contents of my jax-ws-catalog.xml and the relevant xsd and wsdl if that will help.

A Google search turns up lots of other problems with jax-ws-catalog.xml not working in the Metro stack.

Has anyone gotten a jax-ws-catalog.xml to work in Metro?

Best Answer

Where are you placing the jax-ws-catalog.xml and the WSDL files ?

You mentioned that you're using a WAR, but within a WAR the location of jax-ws-catalog.xml depends on whether you're trying to access it as a WS client or as a WS Endpoint publisher (server).

If you're accessing external Web Services from within your WAR, then your jax-ws-catalog.xml needs to go in app.war/WEB-INF/classes/META-INF directory, Alternatively if you have a contract first web service deployed within your app, and that has the @WSDLLocation annotation, then for that WSDL, jax-ws looks for jax-ws-catalog.xml in app.jar/META-INF

So for client WSDL location app.war/WEB-INF/classes/META-INF/jax-ws-catalog.xml for contract first WS Endpoints with @WSDLLocation annotation the app.war/META-INF

If you want to do both, i.e. publish (contract first) as well as consume Web Services, then you need to put jax-ws-catalog.xml + WSDLs in both the locations, i.e. app.jar/WEB-INF/classes/META-INF and app.jar/META-INF

I have successfully used the above approach in many of my projects, which simultaneously publish as well as consume web services, and I can guarantee it works as expected.

Related Topic