Patterns for communicating to legacy services.
We are in the process of designing an MVC web application that will need to communicate with legacy web services (non .Net). The services accept and return xml structures. The returned xml structures are then used to hydrate our domain model. The services are the applications only source of data.
What are your opinions on patterns used to communicate with the legacy services? The goal would be to create a clean, easy to use interface that is exposed to our controllers.
Create a DataContext that is backed by DataMappers. A controller would then communicate with the datacontext to do CRUD activities for our domain objects. The datacontext would then use the mappers to form xml requests which are then queued up and issued to the legacy services. On return the datacontext would then use the mappers to hydrate domain objects based on the returned xml.
Use the request/reply pattern and a request dispatcher. Where the controller would create the request object and the dispatcher would issue that request to the legacy service. The dispatcher would be responsible for formatting serializing the requests/responses to the proper format.
ObjectOneRequest request = new ObjectOneRequest();
request.entitty = objectOne;
request.actionType = create;
request.requestId = guid.newGuid().ToString();
ObjectOneResponse response = Dispatcher.Responses(request.requestId);
C Lock, Jun 25, 2010