Home Ask Login Register

Developers Planet

Your answer is one click away!

May12 February 2016

Spring Boot + Apache CXF: why can't find wsdl?

Collegues, I am still trying "to make friends all" Spring-Boot, Tomcat and web service implementation class:

                      serviceName = "ServiceForApp",
                      portName = "ServiceEndPoind",
                      targetNamespace = "http://new.webservice.namespace",
                      endpointInterface = "com.comp.appserv.WebServiceInterface",
                          wsdlLocation = "resources/WebService.wsdl"

public class ServiceEndPoindImpl implements WebServiceInterface {logic};

I have an application class:

package com.comp.config;

import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import com.comp.appserv.ServiceEndPoindImpl;

import javax.xml.ws.Endpoint;

public class Application  {

    public static final String SERVLET_MAPPING_URL_PATH = "/soap/*";
    public static final String SERVICE_NAME_URL_PATH = "/app";

    private ApplicationContext applicationContext;

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);

    public ServletRegistrationBean dispatcherServlet() {
        return new ServletRegistrationBean(new CXFServlet(), SERVLET_MAPPING_URL_PATH);

    @Bean(name = Bus.DEFAULT_BUS_ID)
    // <bean id="cxf" class="org.apache.cxf.bus.spring.SpringBus">
    public SpringBus springBus() {
        return new SpringBus();



smarquis February 2016

Spring is using the path from the annotation; but as it is a relative path, the current directory (where your app is started rom ) is used to build the full path.


wsdlLocation = "classpath:resources/WebService.wsdl"

to search through the classpath.

As for question 2, is it the right approach to start with so long as nothing prevents it. Your IT infrastructure might veto it for some reasons.

Post Status

Asked in February 2016
Viewed 3,119 times
Voted 13
Answered 1 times


Leave an answer

Quote of the day: live life