Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / May 2006

Tip: Looking for answers? Try searching our database.

WSE 3.0 , Set Policy

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Loyola stalin - 23 May 2006 08:07 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.