Issue
I am trying to consume the WSDL file in the spring boot application, WSDL file is placed into the src/main/resource/wsdl/file.wsdl
.
Project structure:
src="https://i.stack.imgur.com/h0q1m.png" alt="enter image description here" />
Code:
static {
URL url = null;
try {
url = new URL("file:///" + System.getProperty("user.dir") + "/src/main/resources/wsdl/outbound.wsdl");
} catch(IOException e) {
java.util.logging.Logger
.getLogger(OutboundService.class.getName())
.log(java.util.logging.Level.INFO,
"Can not initialize the default wsdl from {0}",
"file:/D:/ERPLOGIC/ERPProjects/JAVA/mavenproject/eclipse-workspace/topconpoc/src/main/resources/wsdl/outbound.wsdl");
}
WSDL_LOCATION = url;
}
It works fine in locally, but when deployed in the AWS server as a war file, it does not work.
What is the proper to refer to the path in the Spring Boot application?
Solution
Try this
URL url = Thread.currentThread().getContextClassLoader().getResource("wsdl/outbound.wsdl");
This should work
Answered By - Shivaji Pote
Answer Checked By - Marie Seifert (JavaFixing Admin)