I have to provide an interface to a set of web services for which I have generated the code stubs and object binding. Many of the transactions share a common object model and thus a large part of the generated code overlaps. Normally this would not be a concern as I would just re-use the same code since the wsdl would link the same xsd files.
Unfortunately here the provider of these services has separated the xsd so that each services binds to a separate set (basically a copy) of the same files. In their specification they state that the implementation of the client side should isolate each web-services for easier maintenance. Basically they want to be able to modify the xsd for a single web service while leaving all others untouched.
The question is as follows :
How could I integrate these different set of generated classes in the same program so that each services exposes their functionality without interfering with their brethren ?
One solution I thought was to create a facade for each of them that would expose the desired functionality and object model so that the actual implementation remains hidden. Then though clever use of custom class loaders each facade would load a specific jar containing the generated code for this particular service.
Any thought ? ideas ? what was your experience facing a similar problem ?
thanks
In general, the easiest way to handle this is to use a jaxb binding file (or the -p param to CXF’s wsdl2java tool) to map the generated code into a package specific for the particular service. Thus, each service would have it’s own objects to work with.
The complexity would come if you have to integrate the various services. Like take the return from one to call into another. Since the objects would be completely different, you would need to write code to copy data from one to the other. Possibly not fun. 🙁