Я использую проект Spring Boot v2.2.2..RELEASE и SOAP.
Я загружаю два разных проекта. WSDL в мой проект. Один URL-адрес генерируется на http://localhost:8080/employee/employee-soap, который работает нормально. Но http://localhost:8080/student/student-soap это выдает ошибку ниже.
2020-02-17 15:31:00.241 WARN 20236 --- [nio-8080-exec-5] o.s.w.soap.server.SoapMessageDispatcher: не удалось обработать заголовки mustUnderstand: {http://docs.oasis-open.org/wss/2004/01/ ... xt-1.0.xsd} Безопасность. Возврат ошибки
JavaCode:
Код: Выделить всё
@EnableWs
@Configuration
public class AppConfig extends WsConfigurerAdapter {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/*");
}
@Bean
public SaajSoapMessageFactory messageFactory() {
SaajSoapMessageFactory messageFactory = new SaajSoapMessageFactory();
messageFactory.setSoapVersion(SoapVersion.SOAP_11);
messageFactory.afterPropertiesSet();
return messageFactory;
}
@Bean("empXSD")
public XsdSchema organizationSchema() {
return new SimpleXsdSchema(new ClassPathResource("/xsd/employee.xsd"));
}
@Bean(name = "employee")
public DefaultWsdl11Definition defaultWsdl11Definition(@Qualifier("empXSD") XsdSchema schema) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("employee");
wsdl11Definition.setLocationUri("employee/employee-soap");
wsdl11Definition.setTargetNamespace("urn:example.com:dms:wsdls:employee");
wsdl11Definition.setSchema(schema);
wsdl11Definition.setCreateSoap11Binding(true);
return wsdl11Definition;
}
@Bean
@Qualifier(value="stuXSD")
public XsdSchema stuSchema() {
return new SimpleXsdSchema(new ClassPathResource("/xsd/student.xsd"));
}
@Bean(name = "student")
public DefaultWsdl11Definition geographyWsdl11Definition(@Qualifier("stuXSD") XsdSchema schema) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("student");
wsdl11Definition.setLocationUri("student-soap");
wsdl11Definition.setTargetNamespace("urn:example.com:dms:wsdls:student");
wsdl11Definition.setSchema(schema);
wsdl11Definition.setCreateSoap11Binding(true);
return wsdl11Definition;
}
@Override
public void addInterceptors(List interceptors) {
interceptors.add(new Interceptor(endpoints, req));
}
}
Код: Выделить всё
@Configuration
public class SimpleMustUnderstandEndpointInterceptor implements SoapEndpointInterceptor{
private final String SAMPLE_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
@Override
public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception {
return true;
}
@Override
public boolean handleResponse(MessageContext messageContext, Object endpoint) throws Exception {
return true;
}
@Override
public boolean handleFault(MessageContext messageContext, Object endpoint) throws Exception {
return true;
}
@Override
public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex) throws Exception {
}
@Override
public boolean understands(SoapHeaderElement header) {
if(header.getName().getNamespaceURI().equalsIgnoreCase(SAMPLE_NS)) {
return true;
}
return false;
}
}
Во время вызова конечной точки SOAP передается информация ниже заголовка и выдается ошибка, как я упоминал выше. Есть какие-нибудь подсказки?
Код: Выделить всё
aispoc_usr1
aispoc_usr1/fdGCEilz/dkVeZE05b7LQ==
Подробнее здесь: https://stackoverflow.com/questions/602 ... ss-2004-01
Мобильная версия