WebService Method Policy Injection

Topics: Service Factory Modeling Edition Forum
May 7, 2008 at 11:43 AM
I understand how to use the Enterprise Library Policy Injection Block but I would like to know how this would be implemented using Web Services and also whether the Web Service Software Factory allows for this.

Ideally what I would like is to specify a Tag attribute on a web service method and use policy injection to execute a handler before and after that method is called.

Is this possible and how would I go about this?
Developer
May 7, 2008 at 3:25 PM
You can find samples of PIAB in the entlib site (codeplex/entlib) or samples included in msi.
On the other hand, there are some more samples regarding WSSF integration here:
http://www.codeplex.com/EntLibExtensionsWSSF
May 7, 2008 at 3:55 PM

charlyfriend wrote:
You can find samples of PIAB in the entlib site (codeplex/entlib) or samples included in msi.
On the other hand, there are some more samples regarding WSSF integration here:
http://www.codeplex.com/EntLibExtensionsWSSF


Thank you for the reply but I what I am after is some more information as to how I could go about creating a custom handler for using policy injection specifically with web services. For example, ideally I would like to have the following:

WebService(Namespace = "http://www.MyDomain.com/")
WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)
ToolboxItem(false)
public class WebServiceClass : System.Web.Services.WebService
{
Tag("Injector")
public int MyWebServiceMethod(string value)
{

}

}

Usually this would be perfectly fine and I could spawn an instance of the object using the policy injector wrapper. This would find the applied attribute and fire off the call handler. What I am unaware of is how this would work with web services given that the methods are called directly, and as far as I'm aware the object is created indirectly.
Developer
May 7, 2008 at 5:00 PM
I'm not quite familiar with Policy AB but I guess you will find better answers in the entlib forum http://www.codeplex.com/entlib/Thread/List.aspx?TagName=Policy%20Injection%20Application%20Block.
Or som other ideas with WCF services:
http://msdn.microsoft.com/en-us/magazine/cc136759.aspx