SM-2314: Avoid IndexOutOfBoundsException in service operations (Closes #13)

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>

(Cherry picked from the commit 3a4e3099010d96299a686ae04d99a5f8bc733d28)