views:

28

answers:

1

I am trying to create a number of WCF services. These services will expose certain public methods and require to consume each other (i.e. call WCF Service methods from another WCF Service)

Is there any good reference tutorial material that I can refer to for this?

Thanks all in advance!

+2  A: 

Consuming a web service in another web service is no different to consuming it in any other client. You create a proxy and make your call so all the general WCF documentation and tutorials will apply.

However, this is usually not a good practice - although sometimes is unavoidable in an SOA. Services must be consumed by clients and they should not call each other unless they have to.

There are a host of problems that can happen. First of all, a service has to wait for the result of a synchronous call from one or more services to return and your service thread will be locked until those calls are finished. If one call takes long, the other service will take long as well and you will have scalability issues.

Let the client call these services. If a call requires data from another service, get the client to make the call and get the data and then make the call again.

Aliostad
The issue you describe can be solved with the reentrant concurrency mode.
Johann Blais
reentrant allows two way communication (and is bad bad bad - IMHO). Here client users service1 which in turn, uses service2.
Aliostad