I am in the process of developing a WCF Service(WCFManager) which would send out request to other services and get response back. For this I developed a WCF service.
Trying to accomplish the following (Assuming that my service name is WCFManager
)
What I did so far
- Added a service reference of
Service X
toWCFManager
which created a reference.cs and a WCF Client. Using the WCF Client generated by adding service reference and sending the request to
Service X
by using the following codeWCFManagerClient client = new WCFManagerClient(); Response response = client.GetResponse(request);
What am I trying to accomplish
- I want to add few config settings in a
App.Config
file ofService X
,Service Y
,Service Z
which I did. - Reuse the same WCFManagerClient to send the request to
Service Y
orService Z
by reading the endpoint information from the config file. My assumption is that when I use theWCFManagerClient
to send the request it uses the reference.cs created in the service reference of the WCFManager service.If my assumption is true can I change the reference.cs on the fly to include theService Y
binding information when I send the request toService Y
and same with theService Z
. This way I don't have to create a proxy for each Service. - Is it possible to reuse the same reference.cs file generated but include the binding information on the fly from config file.
3.I have no control over the
Service Y
orService Z
but all I know is services Endpoint information and the method names and the schema of each service would be the same.
I am not sure if this is possible in WCF if some one has gone through such design with WCF but any suggestions about my approach is apreciated.