Handle proxy classes in RestServiceImpl, and a test.

See https://tickets.openmrs.org/browse/RESTWS-373