What you can do is present the interface for the required service in terms of your domain model in your domain project. Each time your domain class needs a service, you pass it a link to the implementation of this interface.
Then you create a “connector implementation” that implements this interface and connects to the web service that you want to use. When you launch the application, you provide your domain classes to this implementation, for example, using the dependency injection infrastructure.
This connector has a link to your domain model and web service definition. Your domain model does not have a link to a connector implementation or a web service — it only knows the interface defined in the domain project. This is called control inversion.
Thus, your domain classes do not know anything about the web service, but only about the interface that you defined in your domain model. In this way, your domain logic remains separate from the "evil" outside world.
source share