Content-based SOAP Routing is cool (and really easy) - Stuart Gunter
in

dotnet.org.za

South African .NET Developer Portal

This Blog

Syndication

News


Get Firefox!
<!-- Begin Nedstat Basic code --> <!-- Title: StuartGunter --> <!-- URL: http://dotnet.org.za/stuartg/ --> <!-- End Nedstat Basic code -->

Stuart Gunter

There's too much!

Content-based SOAP Routing is cool (and really easy)

I was playing around last night with content-based SOAP routing, and I didn't realise how easy it was until I actually tried to get something working. I'm guessing it took me around 30 minutes to get a basic demo working, which is really fast, when you consider the massive benefits it can give!

For anyone that's interested, it's really just a matter of defining your own SoapHttpHandler, and registering it in the web.config file. The SoapHttpHandler class is in the Microsoft.Web.Services2.Messaging namespace (part of the WSE 2.0). Once you've done that, just override the ProcessRequestMessage method, and then code in whatever algorithm you want to handle the routing aspect. It's really that easy! I did a basic sample project that routes a web method call to different web services based on the requestor.

There are easier ways to do this (purely config file based), but you won't be able to do content-based routing without a little code (from my understanding). I managed to hook this up with about 10 lines of code, and it's completely dynamic from there.

Anyway... just thought I'd share that.

Happy programming!

Published Jun 03 2005, 07:59 PM by stuartg
Filed under:

Comments

 

Mark said:

The other day I was doing a sample creating a custom HTTPModule (not that I actually needed it; so just for interest sake really!). It was also pretty much as easy as your Routing example- implement IHttpModule, hook up events, handle them, register the new module in web.config - and Bob's your aunty!
June 6, 2005 8:45 AM
 

Stuart Gunter said:

Yep, it's really cool how easy that stuff is. I must say that I'm very impressed with how well Microsoft has done their web services technologies. It makes it an absolute pleasure working with web services that are so well constructed (provided you know what you're doing).
June 6, 2005 6:21 PM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Powered by Community Server (Commercial Edition), by Telligent Systems