Hi I'm trying to make an @endpoint SOAP service, but when I try to get the WSDL I get an 405 Method Not Allowed.
There is my service endpoint :
@Endpoint
public class SubscribeMemberService {
public static final String NAMESPACE_URI = "urn:v1.webservice.subscription.test.org";
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "subscribe")
@ResponsePayload
public SubscribeMemberResponse subscribe(@RequestPayload SubscribeMemberRequest request) throws SubscribeMemberFault_Exception {
LOG.info("request received: LastName:" + request.getName().getLastName());
SubscribeMemberResponse response = new SubscribeMemberResponse();
response.setInfoMessage("Subscription of " + request.getName().getLastName());
LOG.info("sending response:" + request.getName().getLastName());
return response;
}
}
And there is my WS config :
@EnableWs
@Configuration
@ComponentScan("org.test")
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, "/ws/*");
}
@Bean(name = "subscribeMember")
public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema subscribeMember) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("subscribeMemberPort");
wsdl11Definition.setLocationUri("/ws");
wsdl11Definition.setTargetNamespace(SubscribeMemberService.NAMESPACE_URI);
wsdl11Definition.setSchema(subscribeMember);
return wsdl11Definition;
}
@Bean
public XsdSchema subscribeMemberSchema() {
return new SimpleXsdSchema(new ClassPathResource("META-INF/wsdl/subscribeMember.xsd"));
}
}
Could it be link to the WebSecurityConfigurerAdapter? Because on the /ws/* I don't have an 404 not found, but I get 405 not allowed. Any ideas?
Note : the security filter in the WebSecurityConfigurerAdapter class is
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic()
.and()
.authorizeRequests()
.anyRequest().hasRole("mySuperRole").and()
.csrf().disable();
}
I found the solution: