Handles service and rpc.