factored out web services code
implemented web services functionality