Global function for creating a service instance.