I’ve found the following thoughts quite interesting…
The WS-Policy framework allows you to make statements about your Web Services such as their preferences, requirements or capabilities. Since policies are part of the messaging infrastructure, they can be applied to services after they’ve been deployed.
WS-PolicyAssertions specifies some predefined assertions. Part of this specification is the MessagePredicate assertion: It can be used to make statements about a message.
But now the quiz:
The following example consists of a policy assertion and a Web Service implementation. The idea is to define an assertion that only accepts messages where Issue5ReqMsg.something is greater than 4. How would your policy assertion look like?
As always, answer and explanation will follow…
<!-- Assertion goes here -->
public class Issue5ReqMsg
public int something;
public class Issue5RespMsg
public class Issue5
[SoapDocumentMethod(ParameterStyle = SoapParameterStyle.Bare)]
public Issue5RespMsg DoSomething(Issue5ReqMsg reqMsg)
Issue5RespMsg respMsg = new Issue5RespMsg();
respMsg.something = reqMsg.something * 5;