Reputation: 768
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?
Upvotes: 1
Views: 2760
Reputation: 4533
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");
Upvotes: 3
Reputation: 137084
There are two possible ways:
Class.getResource(String name)
.http://example.com/MyWebService?WSDL
(note the ?WSDL
at the end).Upvotes: 2