2

I'm taking my first steps with Spring Boot and creating a SOAP web service.

Following the Producing a SOAP web service (https://spring.io/guides/gs/producing-web-service/) tutorial, I managed to create a simple web service that worked.

Expanding on that example, now I'm trying to create a web service with more than one operation. This time I used a wsdl to generate all the JAXB classes. Everything is generated correctly and I can call the web service and get the wsdl as a result.

I then used SOAP UI to generate sample requests for my methods based on the returned wsdl, but when I try to execute them I get the error (actually warning):

WARN 10280 --- [nio-8080-exec-1] o.s.ws.server.EndpointNotFound : No endpoint mapping found for [SaajSoapMessage Ping]

And I've been stuck in this for the last two days. Thinking that the problem could be a mismatch in the parameters of my endpoint method, I tried creating an operationg (Ping) that receives a single string, but even that one fails.

I'm using a configurator class and all the examples I could find use configuration files (web.xml and the servlet file), and I can't put the pieces together to fix this.

This is my configuration class (I've removed the imports to save space):

package ws;

@EnableWs
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
    MessageDispatcherServlet servlet = new MessageDispatcherServlet();
    servlet.setApplicationContext(applicationContext);
    servlet.setTransformWsdlLocations(true);
    return new ServletRegistrationBean(servlet, "/SVN/*");
}


@Bean (name = "SVNClient")
  public Wsdl11Definition defaultWsdl11Definition() {
    SimpleWsdl11Definition wsdl11Definition = new SimpleWsdl11Definition();
    wsdl11Definition.setWsdl(new ClassPathResource("/wsdl/SVNClient.wsdl"));

    return wsdl11Definition;
  }
}

And this is the class where I have my Endpoints (I've removed the imports to save space):

package ws;

@Endpoint
public class WebServiceEndPoint {
private static final String NAMESPACE_URI = "http://gestion.svn.client";

@Autowired
public WebServiceEndPoint() {
    System.out.println("Entramos en WebServiceEndPoint");
}

@PayloadRoot(namespace = NAMESPACE_URI, localPart = "Ping")
public @ResponsePayload PingResponse ping() {
    PingResponse resposta = new PingResponse();
    resposta.setOut("I'm in");
    return resposta;
}

@PayloadRoot(namespace = NAMESPACE_URI, localPart = "getLog")
public @ResponsePayload GetLogResponse getLog(@RequestPayload InputParameters wsPayload) {
    GetLogResponse response = new GetLogResponse();

    response.setCODERROR("0");
    response.setMENSAJEERROR("I'm in");

    return response;
}

My doubt is:

Are the @Endpoint and @PayloadRoot annotations enough to map the endpoints to the web service operations? I mean:

  • Is there something on the methods or parameters declaracion which makes them not match the web service definition?
  • Or do I still need some configuration file (web.xml, servlets or something else) to perform this mapping?
Bond - Java Bond
  • 3,972
  • 6
  • 36
  • 59
JPV
  • 21
  • 1
  • 3

1 Answers1

0

After rebuilding the wsdl it started working. I guess something was not right and it didn't match my endpoint definition.

JPV
  • 21
  • 1
  • 3
  • I have faced the same issue, trying to follow thru the tutorial. My Problem was that I have somehow missed the `@Endpoint` annotation. See details in this answer - https://stackoverflow.com/a/66242908/1864614 – razvang Feb 17 '21 at 14:10