.NET Framework Bookmark and Share   
 index > Windows Communication Foundation > Single proxy for multiple services
 

Single proxy for multiple services

Hi All,

I have some interesting scenario which many of you might have resolved previously.

I have deployed WCF services as UK.Services.Core.Svc and UK.Services.Common.Svc. Now I want to create services for our US branch; the namespace would be US.Services.Core.Svc and US.Services.Common.Svc. These 2 services shares common shared types from Framework.EntityObjects.

Now lets say if I have a method called ValidateVAT which is written in both UK.Services.Common.Svc as well as US.Services.Common.Svc; how does my proxy will differentiate between these 2 methods?

What is the best way to create proxies in this scenario (single or multiple)? How to consume these 2 services into my website?

Any help would be of great help.

RahulSisodia
Hi Rahul,
Once the namespace is different (for the services, although entity objects may have the same namespace)and the physical instances are different, how does it matter. It will work anyways.


|WebSite1| Proxy| Server(Service 1 and Service 2) - different instance of business object |

Specially if the service and the business objects are stateless, you have zero issues. Not able to get the exact issue.


Thanks,
-Phani
Phani_tpk
Hi Rahul, a proxy in WCF can connect to a single endpoint at the time so you basically should have two different proxy objects. If having multiple proxies bothers you, you could create some sort of wrapper object and incorporate all the logic inside of it (some sort of facade pattern).

Regards,
Stipe-Ivan
Stipe-Ivan Latkovic
Hi Phani/Stipe

Thank you for your replies.

yes, I understood I was totallymissing namespace for my service contracts; I have given a namespace to my new US services and every thing works fine now.

<ServiceContract([Namespace]:=

"http://domain.co.uk/USCommonservice")> _

Also while creating proxy I have given language:VB -n:http://domain.co.uk/USCommonservice,USCommonService; so now in my proxy I have USCommonService.CommonClient and just CommonClient exposing diff web methods....

should I give namespace to my 1st service as well; I am in UAT phase now; do you think its imp to do rite away or I can live with out it and for future services will give namespaces...

Regards,
Rahul.

RahulSisodia
Even if you don't mention any namespace, it would default to tempuri.org. And its more of a coding standard/ design standard to mention those. Obviously, its your decision. Since its in UAT, if I were you,I would log a bug to be handled in next release and leave it.

-Phani
Phani_tpk

You can use google to search for other answers

Custom Search

More Threads

• DataContract doesn't work
• WCF Dynamic Proxy (Microsoft)
• Security Issues - ASP.NET + WCF
• The target assembly contains no service types. You may need to adjust the Code Access Security policy of this assemby.
• Submit an XmlDocument object to a WCF Service
• DuplexChannelFactory CreateChannel??
• Unity : Access to WCF service in different Modules
• Check for WCF service
• WCF Custom Username password authentication problem
• Which attribute do i need?