views:

25

answers:

2

I have an external Web Service that returns back its own object, and I would like to get it to compile to my interfaces is this possible?

(IGetPerson)testAPI.GetPersons();

Where testAPI is the external web service

testAPI.GetPerson returns webservice.GetCarResponse, which is of course from the external webservice.

I need to get the results to fit in to my interfaces so I can use IoC

Any ideas?

+1  A: 

Could you have a class that wraps whatever class the webservice returns and implements your interface? The implementation of each property of the interface would simply return or set the corresponding value on the webservice's response object (which would be stored as an instance variable)

The adapter pattern (wikipedia)

Adam
+2  A: 

Sounds like a candidate for the Adapter Pattern to me. Have a look at the example provided by doFactory.

RichardOD