diff --git a/tutorial/build.gradle b/tutorial/build.gradle index 29d5061..a6c7cd1 100644 --- a/tutorial/build.gradle +++ b/tutorial/build.gradle @@ -13,8 +13,8 @@ apply plugin: 'idea' apply plugin: 'war' apply plugin: 'tomcat' -ext.springVersion = '3.2.4.RELEASE' -ext.springWsVersion = '2.1.4.RELEASE' +ext.springVersion = '4.0.2.RELEASE' +ext.springWsVersion = '2.2.0.BUILD-SNAPSHOT' ext.tomcatVersion = '7.0.42' dependencies { @@ -22,7 +22,11 @@ dependencies { compile("org.jdom:jdom:2.0.1") runtime("jaxen:jaxen:1.1.4") runtime("log4j:log4j:1.2.16") - + runtime("org.apache.ws.xmlschema:xmlschema-core:2.1.0") + runtime("wsdl4j:wsdl4j:1.6.1") + + providedCompile("javax.servlet:javax.servlet-api:3.0.1") + testCompile("junit:junit:4.10") testCompile("org.easymock:easymock:3.1") @@ -35,6 +39,7 @@ dependencies { repositories { maven { url 'http://repo.spring.io/libs-release' } + maven { url 'http://repo.spring.io/libs-snapshot' } } task wrapper(type: Wrapper) { diff --git a/tutorial/src/main/java/com/mycompany/hr/config/HRConfiguration.java b/tutorial/src/main/java/com/mycompany/hr/config/HRConfiguration.java new file mode 100644 index 0000000..941b1fd --- /dev/null +++ b/tutorial/src/main/java/com/mycompany/hr/config/HRConfiguration.java @@ -0,0 +1,40 @@ +package com.mycompany.hr.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; +import org.springframework.ws.config.annotation.EnableWs; +import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition; +import org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection; + +/** + * @author Arjen Poutsma + */ +@EnableWs +@Configuration +@ComponentScan("com.mycompany.hr") +public class HRConfiguration { + + @Bean + public DefaultWsdl11Definition holiday() { + DefaultWsdl11Definition definition = new DefaultWsdl11Definition(); + definition.setPortTypeName("HumanResource"); + definition.setLocationUri("/holidayService/"); + definition.setTargetNamespace("http://mycompany.com/hr/definitions"); + definition.setSchemaCollection(holidayXsd()); + return definition; + } + + @Bean + public CommonsXsdSchemaCollection holidayXsd() { + CommonsXsdSchemaCollection collection = + new CommonsXsdSchemaCollection(new Resource[] { new ClassPathResource("/hr.xsd")}); + collection.setInline(true); + return collection; + } + + + +} diff --git a/tutorial/src/main/java/com/mycompany/hr/config/HRServletInitializer.java b/tutorial/src/main/java/com/mycompany/hr/config/HRServletInitializer.java new file mode 100644 index 0000000..54b9bcb --- /dev/null +++ b/tutorial/src/main/java/com/mycompany/hr/config/HRServletInitializer.java @@ -0,0 +1,30 @@ +package com.mycompany.hr.config; + +import org.springframework.ws.transport.http.support.AbstractAnnotationConfigMessageDispatcherServletInitializer; + +/** + * @author Arjen Poutsma + */ +public class HRServletInitializer + extends AbstractAnnotationConfigMessageDispatcherServletInitializer { + + @Override + protected Class[] getRootConfigClasses() { + return null; + } + + @Override + protected Class[] getServletConfigClasses() { + return new Class[]{HRConfiguration.class}; + } + + @Override + public boolean isTransformWsdlLocations() { + return true; + } + + @Override + protected String[] getServletMappings() { + return new String[]{"/*"}; + } +} diff --git a/tutorial/src/main/webapp/WEB-INF/hr.xsd b/tutorial/src/main/resources/hr.xsd similarity index 100% rename from tutorial/src/main/webapp/WEB-INF/hr.xsd rename to tutorial/src/main/resources/hr.xsd diff --git a/tutorial/src/main/webapp/EMPTY b/tutorial/src/main/webapp/EMPTY new file mode 100644 index 0000000..e69de29 diff --git a/tutorial/src/main/webapp/WEB-INF/hr.wsdl b/tutorial/src/main/webapp/WEB-INF/hr.wsdl deleted file mode 100644 index e21e522..0000000 --- a/tutorial/src/main/webapp/WEB-INF/hr.wsdl +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tutorial/src/main/webapp/WEB-INF/spring-ws-servlet.xml b/tutorial/src/main/webapp/WEB-INF/spring-ws-servlet.xml deleted file mode 100644 index b084852..0000000 --- a/tutorial/src/main/webapp/WEB-INF/spring-ws-servlet.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/tutorial/src/main/webapp/WEB-INF/web.xml b/tutorial/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 408aa8d..0000000 --- a/tutorial/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - MyCompany HR Holiday Service - - - spring-ws - org.springframework.ws.transport.http.MessageDispatcherServlet - - transformWsdlLocations - true - - - - - spring-ws - /* - - -