Hi all,
I am working with WSE3.0. In service we need to explicitly set the Policy
I have shown the sample
[Policy("ServerPolicy")]
public class Service : System.Web.Services.WebService
{
public Service () {}
[WebMethod]
public string HelloWorld()
return "Hello World " ;
}
It’s working perfectly ..
My problem is, I need to write the base class and should apply the policy in
the base class itself. I tried the code as the following
public class Service : BaseServerPolicyFile
{
public Service () { }
[WebMethod]
public string HelloWorld()
return "Hello World "; }
}
[Policy("ServerPolicy")]
public class BaseServerPolicyFile : System.Web.Services.WebService
{
public BaseServerPolicyFile()
{
}
}
But it’s not working.. Can you give me the solution ?
Thanks and Regards
Loyola
Pablo Cibraro - 24 May 2006 15:07 GMT
Hi,
Try with this approach,
public class BaseServerPolicyFile : SoapService
{
public BaseServerPolicyFile()
{
this.SetPolicy("ServerPolicy");
}
}
I have already use this approach before and it works perfectly.
Regards,
Pablo Cibraro
http://weblogs.asp.net/cibrax
> Hi all,
>
[quoted text clipped - 43 lines]
> Thanks and Regards
> Loyola
Loyola stalin - 25 May 2006 15:38 GMT
Hi Pablo Cibraro,
I am highly scare about to say this, I was tried as u said
public class Service : BaseServerPolicyFile
{
public Service () {
}
[WebMethod]
public string HelloWorld() {
return "Hello World ";
}
}
public class BaseServerPolicyFile : SoapService
{
public BaseServerPolicyFile()
{
this.SetPolicy(new AuthorizeFilter());
}
}
But i was not working.. I am panic... Can u gudie me once again ?
Loyola stalin - 26 May 2006 13:16 GMT
Hi Friends..
In client Side (Widows Application)
Instead of setting policy in the App.config, I have done with the Polices
class and it’s working perfecly.
System.Xml.XmlTextReader xr = new
System.Xml.XmlTextReader(@"E:\DualServiceThickClient\wse3policyCache.config");
Microsoft.Web.Services3.Design.Policies pcs = new
Microsoft.Web.Services3.Design.Policies();
pcs.ReadXml(xr);
this.SetPolicy(pcs["ClientPolicy"]);
In Serverside
I want to know how should i apply the same kind of coding ?
I tried with this approach, but it do’t work out
public class Service : BaseServerPolicyFile
{
EventLog logger = new EventLog("Application", ".", " UsrTokenManager ");
public Service () {
logger.WriteEntry("Constructer called here ..");
}
[WebMethod]
public string HelloWorld() {
return "Hello World ";// +this.IdentifyProcess.Name;
}
}
//[Policy(typeof(AuthorizeFilter))]
public class BaseServerPolicyFile : SoapService
{
public BaseServerPolicyFile()
{
System.Xml.XmlTextReader xr = new
System.Xml.XmlTextReader(@"E:\DualService\wse3policyCache.config");
Microsoft.Web.Services3.Design.Policies pcs = new
Microsoft.Web.Services3.Design.Policies();
pcs.ReadXml(xr);
this.SetPolicy(“ServicePolicy”);
}
}
I found that, The constructor not been called , Can u show me the right path