I've been able to get one @Endpoint with a wsdl file working:
@EnableWs
@Configuration
public class EventServerConfiguration extends WsConfigurerAdapter {
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/event");
}
@Bean(name = "wsdl-event")
public Wsdl11Definition defaultWsdl11Definition() {
SimpleWsdl11Definition wsdl11Definition = new SimpleWsdl11Definition();
wsdl11Definition.setWsdl(new ClassPathResource("/wsdl/event.wsdl"));
return wsdl11Definition;
}
@Bean
AnnotationActionEndpointMapping endpointMapping() {
AnnotationActionEndpointMapping mapping = new AnnotationActionEndpointMapping();
return mapping;
}
}
But for my use case I have two wsdl files that I need to handle. Originally I set up a RestController and unmarshalled the body from a xml POST request, but I now want to try the pure spring way.
I assume I need to create two MessageDispatcherServlet, one for each wsdl definition, but I have no idea how to map or register my endpoints correctly.
Any ideas?
Fiddling around I created duplicate (with different wsdl and bean names) WSDLdefinition
beans, and messageDispatcherServlet
through ServletRegistrationBean
has given me the error Servlet messageDispatcherServlet was not registered (possibly already registered?)
while my endpoints seem to show up, but spring returns a 404 on any request to said endpoints.
Spring-ws version: 3