Gidday, I've extending this good work by SharpGIS to include base64 encoded images so that the legends are done via text so caching not an issue. really fast. (same as the new ags online - they have a service based off this ) also added in the ability to send more than one map service at a time so you only need to make one request to the rest service - or still multiple times if you wish too.