├── .travis.yml ├── pom.xml └── src └── main ├── java └── com │ └── blog │ └── samples │ └── services │ ├── AccountService.java │ ├── AccountServiceImpl.java │ └── endpoints │ └── AccountServiceEndpoint.java ├── resources └── log4j.xml └── webapp ├── META-INF └── context.xml ├── WEB-INF ├── config │ ├── spring-config.xml │ └── test.xml └── web.xml ├── index.html └── schemas ├── AccountDetails.xsd └── AccountDetailsServiceOperations.xsd /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk8 4 | script: mvn clean install 5 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | spring-webservices-sample 7 | 4.0.0 8 | 2013 9 | war 10 | com.blog.webservices 11 | 1.0 12 | 13 | 3.1.1.RELEASE 14 | 2.0.0.RELEASE 15 | 1.2.16 16 | spring-webservices-sample 17 | 18 | 19 | 20 | 21 | org.codehaus.mojo 22 | jaxb2-maven-plugin 23 | 1.4 24 | 25 | 26 | 27 | xjc 28 | 29 | generate-sources 30 | 31 | 32 | 33 | false 34 | src/main/java 35 | src/main/webapp/schemas 36 | **/*.xsd 37 | src/main/resources/bindings 38 | false 39 | 40 | 41 | 42 | org.apache.maven.plugins 43 | maven-war-plugin 44 | 45 | ${context.path} 46 | 47 | 48 | 49 | 50 | 51 | 52 | log4j 53 | log4j 54 | ${log4j.version} 55 | 56 | 57 | org.springframework 58 | spring-core 59 | ${spring.version} 60 | 61 | 62 | org.springframework 63 | spring-context 64 | ${spring.version} 65 | 66 | 67 | org.springframework 68 | spring-beans 69 | ${spring.version} 70 | 71 | 72 | org.springframework 73 | spring-aop 74 | ${spring.version} 75 | 76 | 77 | org.springframework 78 | spring-aspects 79 | ${spring.version} 80 | 81 | 82 | commons-collections 83 | commons-collections 84 | 3.2 85 | 86 | 87 | org.springframework 88 | spring-oxm 89 | ${spring.version} 90 | 91 | 92 | org.springframework.ws 93 | spring-ws-core 94 | ${spring.ws.version} 95 | 96 | 97 | org.apache.ws.commons.schema 98 | XmlSchema 99 | 1.4.3 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /src/main/java/com/blog/samples/services/AccountService.java: -------------------------------------------------------------------------------- 1 | package com.blog.samples.services; 2 | 3 | import com.blog.samples.webservices.Account; 4 | 5 | /** 6 | * The Interface AccountService. 7 | */ 8 | public interface AccountService 9 | { 10 | 11 | /** 12 | * Gets the account details. 13 | * 14 | * @param accountNumber the account number 15 | * @return the account details 16 | */ 17 | public Account getAccountDetails(String accountNumber); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/blog/samples/services/AccountServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.blog.samples.services; 2 | 3 | import org.springframework.stereotype.Service; 4 | 5 | import com.blog.samples.webservices.Account; 6 | import com.blog.samples.webservices.EnumAccountStatus; 7 | 8 | /** 9 | * The Class AccountService. 10 | */ 11 | @Service 12 | public class AccountServiceImpl implements AccountService 13 | { 14 | 15 | /** 16 | * Gets the account details. 17 | * 18 | * @param accountNumber the account number 19 | * @return the account details 20 | */ 21 | public Account getAccountDetails(String accountNumber) 22 | { 23 | 24 | /* hard coded account data - in reality this data would be retrieved 25 | * from a database or back end system of some sort */ 26 | Account account = new Account(); 27 | account.setAccountNumber("12345"); 28 | account.setAccountStatus(EnumAccountStatus.ACTIVE); 29 | account.setAccountName("Joe Bloggs"); 30 | account.setAccountBalance(3400); 31 | 32 | return account; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/blog/samples/services/endpoints/AccountServiceEndpoint.java: -------------------------------------------------------------------------------- 1 | package com.blog.samples.services.endpoints; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.ws.server.endpoint.annotation.Endpoint; 5 | import org.springframework.ws.server.endpoint.annotation.PayloadRoot; 6 | import org.springframework.ws.server.endpoint.annotation.RequestPayload; 7 | import org.springframework.ws.server.endpoint.annotation.ResponsePayload; 8 | 9 | import com.blog.samples.services.AccountService; 10 | import com.blog.samples.webservices.Account; 11 | import com.blog.samples.webservices.accountservice.AccountDetailsRequest; 12 | import com.blog.samples.webservices.accountservice.AccountDetailsResponse; 13 | 14 | /** 15 | * The Class AccountService. 16 | */ 17 | @Endpoint 18 | public class AccountServiceEndpoint 19 | { 20 | private static final String TARGET_NAMESPACE = "http://com/blog/samples/webservices/accountservice"; 21 | 22 | @Autowired 23 | private AccountService accountService_i; 24 | 25 | /** 26 | * Gets the account details. 27 | * 28 | * @param accountNumber the account number 29 | * @return the account details 30 | */ 31 | @PayloadRoot(localPart = "AccountDetailsRequest", namespace = TARGET_NAMESPACE) 32 | public @ResponsePayload AccountDetailsResponse getAccountDetails(@RequestPayload AccountDetailsRequest request) 33 | { 34 | AccountDetailsResponse response = new AccountDetailsResponse(); 35 | 36 | /* call Spring injected service implementation to retrieve account data */ 37 | Account account = accountService_i.getAccountDetails(request.getAccountNumber()); 38 | response.setAccountDetails(account); 39 | return response; 40 | } 41 | 42 | public void setAccountService(AccountService accountService_p) 43 | { 44 | this.accountService_i = accountService_p; 45 | } 46 | } -------------------------------------------------------------------------------- /src/main/resources/log4j.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/main/webapp/META-INF/context.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/config/spring-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | schemas/AccountDetailsServiceOperations.xsd 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/config/test.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | contextConfigLocation 11 | 12 | /WEB-INF/config/spring-config.xml 13 | 14 | 15 | 16 | 17 | org.springframework.web.context.ContextLoaderListener 18 | 19 | 20 | 21 | webservices 22 | org.springframework.ws.transport.http.MessageDispatcherServlet 23 | 24 | transformWsdlLocations 25 | true 26 | 27 | 28 | contextConfigLocation 29 | 30 | 31 | 1 32 | 33 | 34 | 35 | webservices 36 | *.wsdl 37 | 38 | 39 | 40 | webservices 41 | /endpoints/* 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | contextConfigLocation 14 | 15 | /WEB-INF/config/spring-config.xml 16 | 17 | 18 | 19 | 22 | 23 | org.springframework.web.context.ContextLoaderListener 24 | 25 | 26 | 33 | 34 | webservices 35 | org.springframework.ws.transport.http.MessageDispatcherServlet 36 | 37 | transformWsdlLocations 38 | true 39 | 40 | 41 | contextConfigLocation 42 | 43 | 44 | 1 45 | 46 | 47 | 48 | webservices 49 | *.wsdl 50 | 51 | 52 | 53 | webservices 54 | /endpoints/* 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Spring Web Services Sample 6 | 7 | 8 | 9 |

Spring Web Services Sample

10 | 11 |

Welcome to the the Spring Web Services Sample

12 |

Visit the WSDL at:

13 | 14 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/webapp/schemas/AccountDetails.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/webapp/schemas/AccountDetailsServiceOperations.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | --------------------------------------------------------------------------------