Wednesday 3 June 2009

Calling one WCF service from another

Over a year ago I hit this problem, and no amount of work would fix it. A year later, having found myself facing it again, I finally found the solution, thanks to this post.

Whilst the solution was simple, I've written my services so they can be unit-tested. Hence references to instances that require the presence of an HttpRequest are not allowed.

The picture below shows my eventual solution. Whilst it has a large number of classes/interfaces, they are each very small and focussed. They combine together extremely well to allow one service to call another, using Inversion of Control to access the child-service's client.

From Tiny drops of knowledge