JEE Project Setup with Gradle, Spring and JAX-WS integration

What I’m going to cover in this sample implementation:

  1. JAX-WS 2.2 Standard conform implementation
  2. Spring 3.0.5 Integration due SpringBeanAutowiringSupport
  3. Generic JPA 2.0 DAO with Hibernate as persistence provider
  4. Gradle 1.x as Build tool
  5. MTOM Transport for medium-size attachments
  6. Generic SLF4J logging with jcl and jul to log4j
  7. JUnit Testing with Spring Integration
  8. Generic Class for Services due DRY principles

Download the example here.

Run the example using: gradle jettyRun on the console. You should see something like:
INFO  - <In-Memory Content Repository started...>
INFO  - <Product Service started...>
INFO  - <Product Service WS-* Endpoint started...>

The sample contains a simple domain with a few objects (Category, Product and Item) where Item is an generic byte[] abstraction item to store contents in a JCR compliant repository like Apache Jackrabbit. In the example it’s just in a Memory table to store Binary attachments. The Repository can be changed by implementing Repository<byte[]> with custom functionality.

Test the sample using SoapUI:


Ensure that Enable MTOM and Force MTOM are enabled. If other transports are available, SoapUI only uses MTOM if the attachment exceeds a specified size. Enforce this transport model to test the webservice.

The services are deployed at the following URL: “http://localhost:8080/shoppingEngine/services/product” . Append “?wsdl” to read the WSDL (during “add project” in SoapUI).