Thursday, July 09, 2009

Local WSDL

When wsimport creates artefacts for accessing a web service, it uses the URL which you specify. However maybe you don't want requests for that WSDL traversing the network when you access a service. In these cases you can store the WSDL locally and access it as a local resource.

To do this, do something like:
URL wsdlURL = this.getClass().getClassLoader().getResource("MyTestService.wsdl");
if (wsdlURL==null) {
LOG.error("unable to get WSDL from local file...");
} else {
LOG.debug("Getting WSDL from: " + wsdlURL.toExternalForm());
}

This should try to retrieve the WSDL from somewhere accessible by the application. In practice, you need to put the WSDL on the classpath, for example in the "WEB-INF/classes" folder.

I needed to do this because the JBoss I'm deploying to doesn't support OASIS Catalogs, so you can't point an application to local WSDL by means of the jax-ws-catalog.xml file that I posted about here.

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

Links to this post:

Create a Link

<< Home