Add unit tests for service action requests and response codes.
Also fixing some bugs where errors where not being returned when
they should have been.