ASP.NET - what is proxy class and what is the use of proxy class?

Asked By shoaib mansoori on 30-Jan-12 11:46 PM
Hello 
i want to know about proxy class.
what is proxy class and what is the use of proxy class?
in which scenario will use the proxy class?
Jitendra Faye replied to shoaib mansoori on 30-Jan-12 11:53 PM
In communications, a proxy is something that acts as a server, but when given requests from clients, acts itself as a client to the real servers.

The WSDL to Proxy Class tool generates proxy code for Web service clients from WSDL files. The generated proxy code contains a class that derives from the http://msdn.microsoft.com/en-us/library/microsoft.web.services3.webservicesclientprotocol.aspx class or the http://msdn.microsoft.com/en-us/library/microsoft.web.services3.messaging.soapclient.aspx class depending upon the type option. Use this generated class to send SOAP messages to SOAP receivers.

refer this link for more details-

http://msdn.microsoft.com/en-us/library/aa529578.aspx
Riley K replied to shoaib mansoori on 31-Jan-12 12:22 AM

A client and a Web service can communicate using SOAP messages, which encapsulate the input and output parameters as XML.


A proxy class maps parameters to XML elements and then sends the SOAP messages over a network.

 In this way, the proxy class frees you from having to communicate with the Web service at the SOAP level and allows you to invoke Web service methods in any development environment that supports SOAP and Web service proxies.

refer this MSDN doc
http://msdn.microsoft.com/en-us/library/ms155134.aspx


Regards
Venkat K replied to shoaib mansoori on 31-Jan-12 12:23 AM
Proxy classes are nothing but individual class files for each datasets of the data services. These classes allow you to easily call the data in the datasets available without much effort.

If you use the pre-generated proxy classes then it would be much faster.  With proxy classes, it simplifies your developement by allowing .NET to process all the consumation of data back end.


Suchit shah replied to shoaib mansoori on 31-Jan-12 12:31 AM

What is it?

Proxy classes are individual class files for each datasets of the data services. This allow developers to easily call the datas in the datasets available without much effort. However, the proxy classes are only available for C# development. Imagine, having to call or to instantiate individual datas in the datasets, it would be much faster using our pre-generated proxy class.

Why should I use proxy classes?

The next question developers have in mind would be “Why use proxy classes?“. With proxy classes, it simplifies your developement by allowing .NET to process all the consumation of data back end. Hence, lesser to code compared to the previous example. One of the amazing things proxy classes allow developers to leverage on is the ability to select certain datas from the dataset and display it any way you want it to with just 5 lines of codes using LINQ.