Writing a rest service