Only generate code for some methods on a service

@danrice-square @loganj 

Doesn't quite turn out to be the same (in particular, if `method == null`).  I cleaned up both methods as much as I could (and it's a bit more clear now).