Groups | Blog | Home
all groups > dotnet web services enhancements > april 2006 >

dotnet web services enhancements : WSE 3.0 - Apply Policy w/out Policy Attribute?



William Leary
4/19/2006 2:36:02 PM
Is there any possible way to apply policies to web services without having to
actually update the codebase by adding the Policy attribute to the web
service class? We would like for this to be doable via XML configuration so
that we do not need to update existing web services code bases to plug in
what we want, which is a custom filter to track messages. In WSE 2.0 we could
do this purely via configuration, which was nice. It appears that this is
William
4/20/2006 10:30:53 AM
Thanks Pablo. Darn. I was afraid of that. I'm rather unimpressed with the
way this was implemented. We are putting together a custom in-house solution
that uses custom SOAP headers to implement web services management. (We can
track flow of calls between services, track response times, keep message
history for troubleshooting, etc) The desire is to keep the solution
transparent to the web services themselves. This was possible with WSE 2,
but now it's not possible with 3. We'd like to use 3, particularly for the
speed enhancement and wire compatibility with WCF, but now we have to have
this code referring to the mgmt functionality in each service, at the
individual class level.

Very unelegant. I cannot understand why they could not have implemented
something like so:

<applyPolicy>
<service name="foo.asmx" policy="myPolicy" />
</applyPolicy>

I must be missing something here. Is there any functional reason for
specifying policy at the class attribute level? Seems utterly ridiculous to
not have this configurable.

[quoted text, click to view]

Pablo Cibraro
4/20/2006 11:59:47 AM
Hi William,

Unfortunately, it is not possible to specify a policy for a service by means
of a configuration setting.
If you do not want to modify the code for your web services, a security
router solution may solve your problem.

The WSE quickstart contains some samples about service routing, C:\Program
Files\Microsoft WSE\v3.0\Samples\CS\QuickStart\Routing
You can also check the Perimeter Service Router pattern,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/WSS_Ch6_PerimServRout.asp

Regards,
Pablo Cibraro
http://weblogs.asp.net/cibrax


[quoted text, click to view]

Pablo Cibraro
4/24/2006 11:02:31 AM
Hi William,

I forgot to mention a workaround to do something like that.

You can develop a base class for your services, and set the policy in the
constructor of that class.

public class MyWebServiceBase : WebService
{
public MyWebServiceBase()
{
//Look for the right policy name in the configuration.

this.SetPolicy(policy);
}
}

public class MyWebService1 : MyWebServiceBase
{
public void HelloWorld(string hello)
{
}
}

Still, you need to modify the web services to use a different base class.

Regards,
Pablo.


[quoted text, click to view]

Loyola stalin
5/23/2006 12:50:02 AM
Hi Pablo Cibraro,

public class MyWebServiceBase : WebService
{
public MyWebServiceBase()
{
//Look for the right policy name in the configuration.

this.SetPolicy(policy);
}

Hoping this.SetPolicy will come only under WebServicesClientProtocol, So
that i tried with this as

WebServicesClientProtocol ob = new WebServicesClientProtocol();
ob.SetPolicy("Serverplocy");

Though it's not working ...

please tell me the righ path ?

Thanks and Regards
loyola





}


[quoted text, click to view]
AddThis Social Bookmark Button