more flexible host detection for service calls

adds a more flexible approach to identifying the baseURL for service
calls. This approach is based on the hostname of the calling page.