Search code examples
security.net-3.5wse3.0

good resource about assert policies in WSE3


where can i find a good resource about assert policies in WSE3 ?


Solution

  • I'm quite a beginner in this feild. i'm trying to implement this code as an exersice. i want to create a soapfilter that will run as a soap message arrives. I'm having trouble with the policy XML

    using Microsoft.Web.Services3;
    using Microsoft.Web.Services3.Design;
    
    
    namespace WebService1
    {
        /// <summary>
        /// Summary description for Service1
        /// </summary>
        [WebService(Namespace = "http://tempuri.org/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        [ToolboxItem(false)]
        public class Service1 : System.Web.Services.WebService
        {
    
        [WebMethod]
        public string HelloWorld(string s)
        {
            return "Hello World" +s ;
        }
    }
    
    public class ValidationFilter : SoapFilter
    {
        string authCode;
    
        public ValidationFilter(string authCode)
        {
            this.authCode = authCode;
        }
    
        public override SoapFilterResult ProcessMessage(
            SoapEnvelope envelope)
        {
            XmlReaderSettings settings = new XmlReaderSettings();
    
            XmlElement elmRoot = envelope.DocumentElement;
            XmlElement elmNew = envelope.CreateElement("title1234");
            elmNew.InnerXml = "blablabla";
            elmRoot.AppendChild(elmNew);
    
    
            return SoapFilterResult.Continue;
        }
    }
    
    public class traceAssertion : PolicyAssertion
    {
        public static readonly XmlQualifiedName BeNiceQName = new
            XmlQualifiedName("traceAssertion", "http://schemas.cohowinery.com/wsbn");
    
    
    
        public override SoapFilter CreateClientInputFilter(FilterCreationContext context)
        {
            return new ValidationFilter("FFFF");
        }
    
        public override SoapFilter CreateClientOutputFilter(FilterCreationContext context)
        {
            return new ValidationFilter("FFFF");
        }
    
        public override SoapFilter CreateServiceInputFilter(FilterCreationContext context)
        {
            return new ValidationFilter("FFFF");
        }
    
        public override SoapFilter CreateServiceOutputFilter(FilterCreationContext context)
        {
            return new ValidationFilter("FFFF");
        }
    
    }
    

    }