Handle proxy classes in RestServiceImpl.

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