您好我正在尝试创建@endpoint SOAP服务,但是当我尝试获取WSDL时,我得到了一个不允许的405方法。
有我的服务端点:
@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;
}
}
还有我的WS配置:
@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"));
}
}
它可以链接到WebSecurityConfigurerAdapter吗?因为在/ ws / *我没有找到404,但我得不到405。有什么想法吗?
注意:WebSecurityConfigurerAdapter类中的安全筛选器是
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic()
.and()
.authorizeRequests()
.anyRequest().hasRole("mySuperRole").and()
.csrf().disable();
}
答案 0 :(得分:0)
我找到了解决方案: