I want to create a spring-ws web service that eventually marshals a POJO into xml. I'd also like the clients of the web service to unmarshal the xml back into the POJO. How should I structure the projects?
Currently my thinking is:
- Domain and business layer project - has the ability to query mainframe and create POJOs. This project has no dependencies to any of the below projects but does depend on the mainframe lib.
- Web service project - implements a web service that receives a request, calls the business logic in project 1, and returns a marshalled domain object from project 1.
- Client project - calls the web service, receives some xml, unmarshals the xml into a domain object from project 1.
The problem I have with this design is that project 3 depends on project 1 for the domain model, but as a result of this, depends on the mainframe libraries. This contradicts my main reason for creating a web service in the first place which was to loosely couple the code.. the flip side is to split out the domain model from the business logic into separate projects but this seems a little extreme..