У меня есть два XSD-файла, один импортируется в другой. При получении WSDL (через SoapUI) импортированный xsd-файл не найден.
Error loading [http://localhost:8294/authentication/shared-environment.xsd]:
org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error:
Unexpected end of file after null
Два xsd-файла находятся в одной папке:
src/main/resources
- auth-attributes.xsd
- shared-environment.xsd
The " auth-attribute.xsd "выглядит следующим образом:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://dto.shared.auth.appl.com"
xmlns:Q1="http://dto.shared.auth.appl.com"
xmlns:Q3="http://dto.common.appl.com" elementFormDefault="qualified">
<xs:import namespace="http://dto.common.appl.com"
schemaLocation="shared-environment.xsd" />
.........
.........
.........
WS-адаптер определяется следующим образом:
@EnableWs
@Configuration
public class BackendServerConfig extends WsConfigurerAdapter {
@Bean
ServletWebServerFactory servletWebServerFactory(){
return new TomcatServletWebServerFactory();
}
@Bean
public ServletRegistrationBean<MessageDispatcherServlet> messageDispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean<MessageDispatcherServlet>(servlet, "/authentication/*");
}
@Bean(name = "authentication")
public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema authenticationSchema) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("SharePort");
wsdl11Definition.setLocationUri("/authentication");
wsdl11Definition.setTargetNamespace("http://dto.shared.auth.timetracker.appl.com");
wsdl11Definition.setSchema(authenticationSchema);
return wsdl11Definition;
}
@Bean
public XsdSchema authenticationSchema() {
return new SimpleXsdSchema(new ClassPathResource("auth-attributes.xsd"));
}
Я не очень знаком с WSDL. Генерация JAXB-источника из XSD в порядке, но разрешение WSDL не удается. Кажется, мне не нужен метод, чтобы сообщить механизму построения WSDL, где получить импортированные XSD.