0

我在哪里可以找到关于 WSE3 中断言策略的好资源?

4

2 回答 2

0

你的意思是WSE还是WCF?我注意到您标记了问题“.net3.5”,它暗示了 wcf。

WSE3,OTOH,是一个基于 .NET 2.0 ASMX 技术的过时框架,它本身几乎已经过时。

这并没有反映您的问题:如果您别无选择,只能使用 WSE,那么您别无选择。只是想澄清您要问的是什么(并确保您知道 WSE 已过时;并非每个使用它的人都知道这一点)。

于 2009-03-12T13:35:22.660 回答
0

我是这个领域的初学者。我正在尝试将此代码作为练习来实现。我想创建一个将在肥皂消息到达时运行的肥皂过滤器。我在使用策略 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");
    }

}

}

于 2009-03-12T13:39:49.827 回答