I received a code recently for a JAX-WS client application, where I saw that a wsdl was specified locally in order to build the endpoint. But it was specified statically, and I do not think this is right.
static {
URL url = null;
try {
url = new URL("file:/home/user/work/src/proj/myproject.wsdl");
} catch (MalformedURLException e) {
e.printStackTrace();
}
WSDL_LOCATION = url;
}
This is not the correct way to do it is it? What is another way to specify the location of this wsdl?
You can place the wsdl in your classpath and refer to it as below:
URL url = ClassLoader.getResource("myproject.wsdl");
Or
URL url = ClassLoader.getSystemResource("myproject.wsdl");