0

I am getting below error when creating a simple web service that returns "hello" string

Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback.

My webservice endpoint:

@WebService
        public class HelloWs {
            @WebMethod
            public String hello() {
                return "hello";
            }
      }

My configuration class:

@Configuration
public class WebServiceConfig {
    @Autowired
    private Bus bus;
    @Bean
    public Endpoint endpoint() {
        Endpoint endpoint = new EndpointImpl(bus, new HelloWs());
        endpoint.publish("/hello");
        return endpoint;
    }
}

My pom.xml dependencies:

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-spring-boot-starter-jaxws</artifactId>
            <version>3.2.7</version>
        </dependency>

    </dependencies>

My project structure:

enter image description here

Vy Do
  • 46,709
  • 59
  • 215
  • 313
Sami Kh
  • 117
  • 2
  • 14

1 Answers1

2

If you are using mvn spring-boot:run then cxf web services are host at /services/*, Thus at url http://localhost:8080/services you will find list of the cxf endpoints, in your case it will be only one. And you get wsdl at location http://localhost:8080/services/hello?wsdl

If you are deploying to any app server add context path before services.

Karthik Prasad
  • 9,662
  • 10
  • 64
  • 112