SM-2314: Avoid IndexOutOfBoundsException in service operations

If an invalid index is passed, throw a JAX-RS WebApplicationException
with HTTP code 404 ("Not found").

Signed-off-by: Gregor Zurowski <gregor@zurowski.org>