This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
We are trying to create a webservice that will be used by a few different applications across the company. Sounds easy enough, but the problem that we are going to run into is that we want to keep the webservice as seperate as possible from the applications. For example, if we have to make changes to the webservice, we don't want to have to redeploy each application with the new client jar file at the same time to accommodate those changes. Is there a way to do this?
I've been playing with Dynamic Invocation Interface and it seems to do what I need it to in the redeploying aspect, but it only handles simple datatypes, not custom objects. Is there any way around this? Does any one have any different ideas?
I don't see how DII solves your deployment problem. Do you plan on developing an autonomously reasoning web service client interface?
You can change the service implementation all you want - the clients don't have to change as long as the interface and the established pre- and post conditions don't change. If you change the service contract your clients will have to change.
Theoretically there is some leeway if you design the XML Schema that your web service contract is based on with extension in mind. However in some cases you would have to make assumptions about how the clients operate - you'll only be able to sneak in a new optional element inside an existing XML document if the client doesn't keep a (obsolete) local copy of the schema for validation and if the XML (un)marshalling code will simply ignore unrecognized elements. In general it is not a good idea to make these kinds of assumptions.
Bottom line: If you don't want to affect existing clients then you cannot change the interfaces (web service contracts) that those clients are using.
However business needs change and new clients with new requirements emerge and the system needs to adapt. To begin with it is always a good idea to separate the service implementation from the web service interface. The service may consume and produce XML documents but it may not be necessary for it to know anything about SOAP.
Once new requirements result in a new interface design, modify the service to satisfy the new requirements and deploy a new web service interface at a new endpoint (and URL) so that new clients can access the new interface and its functionality. In order to relieve the service of the burden of maintaining multiple sets of document standards, insert a transformation stage between the old web service interface and the new service implementation. The transformation stage is basically an anticorruption layer for the service implementation. The transformation stage usually uses XSLT to transform old style request payloads to new style request payloads and new style response payloads to old style response payloads.
When an existing client wants to use the new features it has to be changed anyway - so it will have to start using the new web service interface.