How To: Obtain a list of receive actions when an ASDK-based Adapter is used with BizTalk in a Receive Location
The WCF LOB Adapter SDK (ASDK) contains a behavior named "InboundActionEndpointBehavior" which you can add to your ServiceHost in inbound scenarios. What this behavior does is, at runtime, analyzes the contract deployed, determines the Actions on the Contract, and passes those to the adapter in the StartListener() call (on the IInboundHandler interface) via the "string actions" parameter. This allows the adapter to determine what actions the user is listening for, and send only messages of those type.
More information on this can be found at: http://blogs.msdn.com/sonuarora/archive/2007/06/11/passing-soap-actions-to-adapter-inbound-handler-for-filtering-type-of-listeners.aspx
What do you do when the adapter is used in a Receive Location from BizTalk? The WCF Adapter allows you specify endpoint behaviors for the ServiceHost which it creates, and that's how you can plug in the InboundActionEndpointBehavior. However, this doesnt work as expected. Reason - the WCF Adapter uses an "untyped" contract for the Service, i.e., the Action/ReplyAction is specified as "*" / "*". Hence, even if you add the endpoint behavior, the "string actions" array just contains "*". How would a user let the adapter know what operations he is interested in?
Attached is a sample endpoint behavior which you can use. The primary difference between this behavior and the one which ships with ASDK is this - the ASDK behavior determines the list of actions from the deployed contract, and passes those to the adapter. On the other hand, the sample endpoint behavior (attached) gets the list of actions via user input. That is, while configuring your receive location, add this endpoint behavior (via the behaviors tab), and you'll see two properties: "receiveActions" and "delimiter". You need to concatenate all the actions into a single string and set it on the "receiveActions" property. Also, specify the delimiter you used in the "delimiter" property. The behavior will then split the concatenated string into a list of actions, store them in an ASDK specific class, and add this object to the Binding Parameter Collection. ASDK will then pick out the actions from there and pass them to the adapter in the StartListener call.
The attached .cs file contains comments towards the top of the file detailing how it needs to be compiled, and what entries need to be made in machine.config.