Kick off question -- WCF BAM interception for unmatched message handlers
I would like to kick off this forum with the following question.
How would you enable BAM interception when your WCF service uses unmatched message handlers? What is your filter going to look like in the abscence of specific operation names?
Bring your answers in !!
- Amlan
In normal filtering for WCF BAM interception, the Filter node of the interceptor configuration (IC) file would contain:
- the call point (e.g. if this is sevice, it would either be ServiceRequest or ServiceReply)
- the operation name
as in the example below:
<ic:Filter>
<ic:Expression>
<wcf
peration Name="GetServiceContractCallPoint" />
<ic
peration Name="Constant">
<ic:Argument>ServiceRequest</ic:Argument>
</ic
peration>
<ic
peration Name="Equals" />
<wcf
peration Name="GetOperationName" />
<ic
peration Name="Constant">
<ic:Argument>AuthorizeWithDataContract</ic:Argument>
</ic
peration>
<ic
peration Name="Equals" />
<ic
peration Name="And" />
</ic:Expression>
</ic:Filter>
However, in the case when the service is using a unmatched message handlers, the filter would need to be filter by the action.
<ic:Filter>
<ic:Expression>
<wcf
peration Name="GetServiceContractCallPoint" />
<ic
peration Name="Constant">
<ic:Argument>ServiceRequest</ic:Argument>
</ic
peration>
<ic
peration Name="Equals" />
<wcf
peration Name="XPath">
<wcf:Argument>//s:Envelope/s:Header/a:Action/text()</wcf:Argument>
</wcf
peration>
<ic
peration Name="Constant">
<ic:Argument>http://Microsoft.BAMWCFInterceptor.Test/ITxn/ClientOperation1</ic:Argument>
</ic
peration>
<ic
peration Name="Equals" />
<ic
peration Name="And"/>
</ic:Expression>
</ic:Filter>
Or to simplify the above, in case, you don't want to spell out the whole action including the namespace, you can use the XPath contains command such illustrated as below:
<ic:Filter>
<ic:Expression>
<wcf
peration Name="GetServiceContractCallPoint" />
<ic
peration Name="Constant">
<ic:Argument>ServiceRequest</ic:Argument>
</ic
peration>
<ic
peration Name="Equals" />
<wcf
peration Name="XPath">
<wcf:Argument>contains(//s:Envelope/s:Header/a:Action/text(),"ClientOperation1")</wcf:Argument>
</wcf
peration>
<ic
peration Name="And"/>
</ic:Expression>
</ic:Filter>