I am consuminbg a web service and I have places my WSDL in class path inside WEB-INF/classes
directory. I am running the following code in a tomcat server.
First Approach
static {
URL WSDL_LOC=WSClient.class.getClass().getClassLoader().getResource("Data.wsdl");
System.out.println("Location here is : " + WSDL_LOC);
}
Second Approach
static {
URL WSDL_LOC = Thread.currentThread().getContextClassLoader().getResource("Data.wsdl");
System.out.println("Location here is : " + WSDL_LOC);
}
When I run my war inside of tomcat tyhe first approach prints a null
on the console while the second console actually prints it right. I just wanted to know why is it so and what is the right way of doing this.