Saturday, September 5, 2020

Spring boot load wsdl file from classpath

 If we are SOAP web service consumer and we have generated the stub from WSDL and want to maintain WSDL in our project or Spring boot jar class-path.

In this case we need to write the following piece of code to load WSDL from project / jar (Spring boot)  class-path.

Modify the URL object inside your service class of stub in  the following manner 

static {

        URL url = null;

        WebServiceException e = null;

        try {

            url = Thread.currentThread().getContextClassLoader().getResource("wsdl/test.wsdl");

        } catch ( Exception ex) {

            e = new WebServiceException(ex);

        }

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home