encapsulate main web service script in serve method