I'm refactoring a service which is dependent on a SOAP service. Unfortunately the SOAP service changes regularly. My service uses classes generated from SOAP's wsdl document. There is no layer that would separate entities defined in the SOAP service from my logic. In other words the SOAP service leaks into mine and its changes cause problems.
I want to fix that. I'm considering an approach in which i create wrappers around the generated SOAP clients which would conform to an interface defined by me. The wrappers would be responsible for:
- translating to/from my interface to what is comming from the SOAP service and what the proxy requires
- calling the service using the wrapped generated client
This way i would limit the impact of changes in the SOAP service so that only the wrappers are affected.
I think this is how it should work according to the "ports & adapters" architecture. Is that approach correct? Can i do it better?