通过看
this guide
,我做了以下更改:
web.xml
删除了
网站.xml
文件赞成添加:
spring.webservices.servlet.init.transformWsdlLocations=true
spring.webservices.path=/ws
到
application.properties
2
spring-ws-servlet.xml
删除了
spring-ws-servlet.xml
配置文件并添加:
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {
@Bean(name = "holiday")
public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema schema) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("HumanResource");
wsdl11Definition.setLocationUri("/holidayService/");
wsdl11Definition.setTargetNamespace("http://mycompany.com/hr/definitions");
wsdl11Definition.setSchema(schema);
return wsdl11Definition;
}
}
我把这个班安排在
@SpringBootApplication
三。
hr.xsd
架构文件到
src/main/resources/ws
并补充道
spring.webservices.wsdl-locations=classpath:/ws/
应用程序属性
更新
也可以通过相应的不同模式输出几个单独的WSDL文件。
holiday-spring-schema.xsd
和
holiday-winter-schema.xsd
holiday-spring.wsdl
和
holiday-winter.wsdl
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {
@Bean(name = "holiday-spring")
public DefaultWsdl11Definition wsdl11DefinitionOne(@Qualifier("holiday-spring-schema") XsdSchema schema) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("HumanResource");
wsdl11Definition.setLocationUri("/holidaySpringService/");
wsdl11Definition.setTargetNamespace("http://mycompany.com/hr/definitions");
wsdl11Definition.setSchema(schema);
return wsdl11Definition;
}
@Bean(name = "holiday-winter")
public DefaultWsdl11Definition wsdl11DefinitionTwo(@Qualifier("holiday-winter-schema") XsdSchema schema) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("HumanResource");
wsdl11Definition.setLocationUri("/holidayWinterService/");
wsdl11Definition.setTargetNamespace("http://mycompany.com/hr/definitions");
wsdl11Definition.setSchema(schema);
return wsdl11Definition;
}
}