Hell!
Actually I am relative new to WCF programming and I make my steps forward, but at the moment I wonder if it is possible to have a call to a WCF service (e.g. search for a Person) and after the service did succeed I want to call another service (e.g. get his addresses).
So the plan is like this
Inside Service GetPersonalData(...)
call Service GetAddresses(...)
call Service GetDiagnoses(...)
The services GetAddresses(...) and GetDiagnoses(...) should be called from inside the service GetPersonalData(...).
And: the services GetAddresses and GetDiagnoses must be able to be called with different endpoints (address, binding ...these data are going to come from the database, not from a .config file).
Maybe this is not a good design, but what I want to achieve is to stay on the server side and not to have many roundtrips client <-> server like this:
Client ----> (serivce GetPersonalData) server
<----- back to client
Client ----> (service GetAddresses) on server
<----- back to client
Client ----> (service GetDiagnoses) on server
<----- back to client
Should be like this
Client ---->
service1
------ service2
------ service3
<----- back to client.
Has anyone an idea of how to do this?
Of course, service1 could do the things of service2 and service3, but this is not what we want to have.
Thank you!
Loading
Amit ChoudharyPosted Feb 11, 2011, 1:47 PM
I think what you asked is valid if service are lying on different servers in this case yes you can call another service with in the service by creating a client with in the service for it.
What if you have all services on the same server then you can put them under the same library and can write you business logic to call one method from other.
There may be a different case if you have service hosted on different ports.(as there's many cases exist)
So in the simplest way you can put the all business logic together under the same library if everything is on the same server.
Thanks.
HarryPosted Feb 11, 2011, 4:17 PM
Good guy - worked it out and it seems to work - although I am always worried to touch the web.config with it's parameters :-)
Thanks a lot!!!
HarryPosted Feb 11, 2011, 2:36 PM
Thank you for your answer.
You are right: I can not assume that all services are lying on the same server. If so and the services would be in the same library, I could just make a normal methodcall, but I think this will not be the case here.
You say I shall just create a client(proxy) and call the other service via my newly created clientproxy? Ok, I will gonna give this a try and I will let you know.
Thanks for the hint, I will check it out right know.
Bye!