在哪里可以找到关于WSE3中断言策略的好资源?
答案 0 :(得分:0)
您的意思是WSE还是WCF?我注意到你标记了问题“.net3.5”,这表明wcf。
WSE3,OTOH,是一个基于.NET 2.0 ASMX技术的过时框架,它本身已经过时了。
这并不反映在您的问题上:如果您别无选择,只能使用WSE,那么您别无选择。只是想澄清你所问的问题(并确保你知道WSE已经过时;不是每个人都使用它知道这一点。)
答案 1 :(得分:0)
我是这个领域的初学者。我正在尝试将此代码实现为exersice。 我想创建一个soapfilter,它将在肥皂消息到来时运行。 我遇到了政策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");
}
}
}