That is something I implemented a while back and was using it for authentication from silverlight. I was just experimenting at the time and haven't used it since. If it works for you feel free to use it, if not then do your own thing would be my advice.
I haven't looked at that code in a while, but I recall what I was trying to accomplish with that was a solution so I did not have to register the endpoints in Web.config because to support multiple sites based on folders I needed to be able to use different urls for each folder site. Also I think I was trying to make it use ssl if available. It worked for me for authentication and roles from silverlight.