I'm doing this by porting working code over from another of our products' server, but -- of course! -- our product and the other product diverge pretty rapidly. On the other hand, the other product has pretty good code, so it mostly seems to work once I iron out the differences.
So far. :)