What are WCF Proxies and what are they good for?

Recently I was brought up in WCF, and I even wrote some production services using WCF. But until recently, I had never looked too much at WCF.

I know the idea of ​​a proxy design pattern. I also know about using a proxy with ASMX web services. But it’s hard for me to understand what a WCF proxy is and how it is used. I looked at MSDN's WCF documentation in detail, but I still don't understand the big picture of using proxies with WCF services.

+7
source share
4 answers

A proxy server is an involuntary service representative outside the process. You call a proxy (which is easy), which sets up communication channels, etc. And talking to a remote service (which is difficult).

See also http://msdn.microsoft.com/en-us/library/ms730144.aspx .

+7
source

The WCF proxy is actually just an abstraction layer. You encode the proxy server (ultimately the interface, which is the service contract) without having to work with the smallest details of the communication processing with the WCF communication logic. The advantage of WCF is that you can use many types of communication with the service (http, wshttp, msmq, named pipes, etc.) with the same proxy.

+3
source

Technically speaking, a proxy is a CLR class that provides a single CLR interface that represents a Service Contract. The proxy provides the same operations as ServiceContract, but also additional methods for managing the proxy server life cycle and connecting to the service

or 

The proxy is used to represent the ServiceContract interface in the server from the client side. Using a proxy server, we can call service methods that are present in the interface that is on the server.

+1
source

A client proxy is required to use WCF services from .NET clients. A proxy is an in-memory object on the client side that provides the same interface or API as the WCF service. Your consumer code will make calls against this proxy and the proxy will send these calls as SOAP messages to the WCF service.

Proxies can be generated by Visual Studio code based on metadata provided by the WCF service, either at the WSDL endpoint or in WS-MetaDataExchange (which is based on SOAP).

If you need more control over the consumption of services, you can proxy servers with a manual code. For example, you want to encapsulate a repeating usage pattern, like setting up credentials, etc.

0
source

All Articles