tags:

views:

9

answers:

0

Hello! I have a routing service of type System.ServiceModel.Routing.RoutingService shipped with .NET 4.0, two different services (contracts are different) and a client.

The idea is to use the Routing Service as an intermediary between a client and these two services. I want a routing service to dispatch messages to a target service based on a contract. Sadly, there is no a built-in ContractFilter, so the following would not work:

 <filters>
        <filter name="Filter1" filterType="Contract" 
 filterData="http://ElinaComputer.Shipyard/IDBService/" />
        <filter name="Filter2" filterType="Contract" 
filterData="http://ElinaComputer.Shipyard/ISimulationService/"/&gt;     
      </filters>

I don't want to resort to XPath filters as it will force the client to add a custom header for each outgoing message, so the only way to solve the problem for me is to create a custom filter.

However I'm pretty sure there must be contract filters in WCF as they are used by WCF infrastructure to identify whether a message is destined for a particular contract (see EndpointDispatcher.ContractFilter Property)

So is there any way I could somehow find and plug WCF's ContractFilter into a filter table or should I just implement a contract filter myself in code?

Thank you very much in advance!