views:

107

answers:

2

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

A: 

Did you mean WSE or WCF? I noticed you tagged the question ".net3.5", which suggests wcf.

WSE3, OTOH, is an obsolete framework based on .NET 2.0 ASMX technology, which is nearly obsolete itself.

This does not reflect on your question: if you have no choice but to use WSE, then you have no choice. Just want to clarify which you're asking about (and make sure you know WSE is obsolete; not everyone using it knows that).

John Saunders
A: 

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");
    }

}

}

Gady