locked
Possible to have WCF Client -> WCF Service -> WCF Service? RRS feed

  • Question

  • I have been working on a distrbuted system where I need to have a WCF Client consume WCF Service #1.   WCF Service #1 needs to send information to WCF Service #2 (WCF Service 2 will run a few functions and respond back with a custom object).  This could be accomplished by using multiple endpoints but in this case, I cannot, Service1 MUST talk to Service2 and the client should have no knowledege that there is even a WCF Service #2. 

     

    Since a Service cannot consume a service, is there an easy way to go about doing this?  I have tried creating a class library as an integration layer between the two, where as the library consumes the WCF Service #2 in a method and WCF Service #1 makes a call to it, but that also does not seem to work correctly.

     

    Thanks in advance.

     

     

    Wednesday, August 15, 2007 5:30 AM

Answers

  • I have solved this now.  There was a problem with the first service not being able to see any of the other config files.

    Wednesday, August 15, 2007 7:59 PM

All replies

  • I have solved this now.  There was a problem with the first service not being able to see any of the other config files.

    Wednesday, August 15, 2007 7:59 PM
  • I am working on a Hello world protorype for the same scenario

     

    Client --> WCF Service 1 ---> WCF Service 2.

     

    Can you let me know the logic behind in acheiving this ?

     

     

    Thanks,

    Ko

     

    Friday, September 26, 2008 7:14 PM
  • Hay Taylor Parsish,

    Yes it is possible to communicate between two wcf services. I will explain a sample scenario , how this can be achieved. You need to know one thing in mind. It all about how configure your wcf services ie. xml scheme.

     For example WCF Service One want to communicate with WCF Service Two. In the app.config or the web.config of the wcf service one , you need to client side endpoint of WCF Service Two. WCF Service One is the client for WCF Service Two.  For example if you u have console client application  , you need to consume the wcf service one , in the app.config you need to add the client side endpoint of wcf service one.

    In the WCF Service One , you should also have the proxy class created  by adding the service reference of wcf service two or this can achieved by creating a channel using the channel factory.


    The follow diagram is given below

    Console Client <=====> WCF Service One <====> WCF Service Two.


    For Better clarification ,

    step one : Create wcfservice library with some bussiness logic(WCF Service One) . Host the WCF Service One using the console host or host the wcf service one in IIS 7.0 or host the wcf service in window service. The WCF Service One should be running.

    step two : Create wcfservice library with some bussiness logic(WCF Service Two) . Host the WCF Service Two using the console host or host the wcf service one in IIS 7.0 or host the wcf service in window service. The WCF Service  Two should be running.

    step three : Be sure that the wcf service two host and running. In the WCF Service One host project  for now we assume a console host , add the service  reference of wcf service two , by doing so you will be creating the adding the client side endpoint of wcf service two to the app.config and the proxy class will be created. Now it  is possible for wcf service one to communicate with wcf service two. Be very sure both the wcf service one and wcf service two are hosted propely and running.

    step four : Now create a sample console client, add the service reference of wcf service one to the console client. By doing do , you will be creating the app.config and the proxy class required for communicating with wcf service one.

    For inter wcf service , it always depends on architecture that you have. WCF Services is mainly used for disturbed architecture.

    It is all about how your configure your wcf service.

    Regards,
    Phijo Philip.




    PHIJO PHILIP
    Wednesday, November 19, 2008 5:26 PM