Domanda

dove posso trovare una buona risorsa sulle politiche di asserzione in WSE3?

È stato utile?

Soluzione 2

Sono un principiante in questo campo. sto cercando di implementare questo codice come una fatica. voglio creare un soapfilter che verrà eseguito quando arriva un messaggio soap. Sto riscontrando problemi con il criterio 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");
    }

}

}

Altri suggerimenti

Intendevi WSE o WCF? Ho notato che hai taggato la domanda ".net3.5", che suggerisce wcf.

WSE3, OTOH, è un framework obsoleto basato sulla tecnologia .NET 2.0 ASMX, che è quasi obsoleto stesso.

Questo non si riflette sulla tua domanda: se non hai altra scelta che usare WSE, allora non hai scelta. Voglio solo chiarire di cosa stai chiedendo (e assicurarti di sapere che WSE è obsoleto; non tutti quelli che lo usano lo sanno).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top