Using PIAB with asmx web services

Topics: Policy Injection Application Block
Aug 2, 2009 at 10:11 PM

Hello All,

I need to use PIAB in some asmx web services that I "inherited". I am familiar with the use of the PIAB with applications and WCF web services but don't know how to proceed in the asmx scenario. These web services are used by the clients via some proxies that compose our client side SDK. 

My question comes from the fact that, to enable policy injection, I need to use PolicyInjection.Create when instantiating my classes. This is simple in the case of an application: just replace the calls to new with calls to PolocyInjection.Create but I don't know how to do this in the case of a asmx web service, in which case the object is instantiated implicitly. Since the app block requires the caller to instantiate a proxy for the target object through the app block itself, I would assume some HTTP handler would have to be created to intercept .asmx requests.

For example,  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)
{

}

}

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.

Any advise would be greatly appreciated.

Kind regards

CD

Aug 3, 2009 at 8:24 AM

Hi,

Sorry but I'm not familiar using PIAB into a Web Service, so I can give much guidance. But you might want to check this link http://www.pnpguidance.net/Post/WebServiceSoftwareFactoryPolicyInjectionApplicationBlockExtensionsEnterpriseLibrary.aspx .

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com