I am designing the back-end to a SOAP web-service and have a question about how I am thinking of doing it.
I am going to go with a simple layered design which consists of 3 separate layers.
Layer 1 -> Layer 2 -> Layer 3
Layer 1 : Will implement the SOAP skeleton interface, so this will be the main entry point of my application. This layer will pull data from the SOAP request and pass it to the business logic layer as a business object. It will get back business objects from the business logic layer with which it will populate a SOAP response.
Layer 2 : Business logic layer that implements the business logic behind the web-service. It will be passed data from Layer 1 and interact with Layer 3, the DAO layer.
Layer 3 : DAO layer which will preform CRUD operations on my DB.
With populating SOAP response objects in my code, the implementation might be a bit messy in Layer 1, so I came up with the following 3 options.
Option 1 - Three layers is enough, any more layers would be overkill. SOAP objects are always going to be messy looking, just get over it.
Option 2 - Create an extra layer between Layers 1 and 2. This layer would take data from the SOAP request, populate a business object which it would then pass to the business logic layer. This would keep the methods in Layer 1 neat and tidy. It would look something like this :
Layer 1 -> SOAP Request -> Layer 1.A -> Business Object -> Layer 2
Layer 1 <- SOAP Response <- Layer 1.A <- Business Object <- Layer 2
Option 3 - Do not create any more layers. Simply create a utility object with a method that takes a SOAP request and returns a business object. I could then pass the business object to Layer 2. The same utility object could then be used in Layer 2 to pass a SOAP response back to Layer 1. Or does this approach kind of blur the lines and make my design less modular?