2 min read

Why I love WSE 3.0

Paul Kinlan

Paul Kinlan

Lead of Chrome DevRel

I have been using WSE 3.0 for a while now and I really like it.  I really like the policy mechanism in the WSE, it affords me a kind of AOP (aspect orientated programming) that I am really starting to get into.   For instance I have made a lot of SoapFilters recently, some handy, some just for tests, but each of them allow me to add an aspect of functionality into the webservice that I am creating in a configuration and not a design time.  If I want security, just add a policy line in the XML config, if I want auditing another line, if I want exception shielding another line.   All of these aspects of the system I am creating can be added at deployment time thus leaving my web service code clean and simple.

An example, pseudo code:

Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->[Webservice]public class OrderService{ [WebMethod] [Policy(ServerPolicy)] public OrderList SubmitOrders(OrderList input) { return OrderListRepository.InsertNewOrders(input); }}

And a policy file (not an actual file that would work in this example) would say:

Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/

--><Policy> <add type="Security" MustHaveRole="Add"/> <add type="Auditing" /> <add type="ExceptionSheilding" /></Policy>

This service code and policy file model is so much cleaner and simpler than what you would have to write if you didn't have an AOP style policy system:

Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/

-->[Webservice]public class OrderService{

[WebMethod] [Policy(ServerPolicy)] public OrderList SubmitOrders(OrderList input) { try { if(User.IsInRole("Add") && User.IsAuthenticated) { OrderListRepository.InsertNewOrders(input); Log.Audit(Success); } else { Log.Error(SecurityError); } } catch(RepositoryException ex) { throw SheildedException(ex, "Problem in Repository"); } catch(Exception ex) { throw SheildedException(ex, "Unkown Exception"); } }}

Now tell me which code you would like to maintain! :)

 

Stay in the loop.

I'm trialing a newsletter. Join for monthly insights into web dev, Chrome, and the open web.

alternate_email

Get in touch

Open to chat about Chrome or Web development.

Book a consultation