Detailed introduction and difference of Remoting and Webservice

  • 2021-08-28 19:54:48
  • OfStack

Difference between Remoting and Webservice:

There is no essential difference in the principle of its implementation, and there are the following differences in the application development level:

1. Remoting can flexibly define the protocol it is based on. If it is defined as HTTP, it is no different from Web and Service. Generally speaking, it likes to be defined as TCP, which is slightly more efficient than Web and Service
2. Remoting is not a standard, while Web Service is a standard;
3. Remoting1 needs to be started through an WinForm or Windows service, while Web Service needs IIS to start.
4. In the development environment of VS. net, the call of Web and Service is specially encapsulated, which is more convenient to use than Remoting

I suggest that Web Service is better, because it is easier to control for development

Remoting1 is used in the C/S system, and Web Service is used in the B/S system

The latter is also a common interface for all languages

The same thing is that they are all based on XML

In order to clearly describe the difference between Web, Service and Remoting, I intend to start with their architecture:

Web Service is generally divided into five levels:

1. Http transmission channel
2. XML data format
3. SOAP package format
4. Description of WSDL
5. UDDI

Generally speaking, Web Service under. NET is relatively simple in structure and easy to understand and apply:

1 Generally speaking, WebService applications under. NET structure are based on. net, framework and IIS architecture, so it is relatively easy to deploy (Dispose).

From the perspective of implementation,

First, WebService must inherit the class of methods exposed to the client from the base class: System. Web. Services. WebService
Secondly, the exposed method must be preceded by [WebMethod] or [WebMethodAttribute]

Operation Mechanism of WebService

First, the client is WSDL from the server to WebService, and at the same time, one proxy class is claimed at the client (Proxy Class)
This proxy class is responsible for Request and Response with the WebService server
When a piece of data (XML format) is encapsulated into a data stream in SOAP format and sent to the server, It will generate a process object and parse the SOAP packet that received the Request, and then process the transaction. After the processing, it will package the calculation result with SOAP, and then send the packet as an Response to the proxy class of the client (Proxy Class). Similarly, the proxy class also parses the SOAP packet and then performs subsequent operations.

This is a running process of WebService.

The following is a general description of. net Remoting:

. net Remoting is a technology developed on the basis of DCOM, Its main purpose is to realize cross-platform, cross-language and penetrate enterprise firewall, which is also its basic feature. Different from WebService, it supports HTTP and TCP channels, and it can not only transmit SOAP packets in XML format, but also transmit binary streams in the traditional sense, which makes it more efficient and flexible. Moreover, it does not depend on IIS, and users can develop (Development) and deploy (Dispose) their favorite hosting server, so WebService is actually a special case of net Remoting in these aspects.
Two Channels of Remoting

There are two main channels for Remoting: Tcp and Http. The IChannel interface is defined in. Net, System. Runtime. Remoting. Channel. The IChannel interface includes the TcpChannel channel type and the Http channel type. They correspond to these two types of Remoting channels, respectively

1. remoting is MarshByReference, can pass variable reference, directly to the server object operation. Fast, suitable for intranet (Intranet).
webservice is of MarshByValue and must pass the value of the object. Slow speed, can pass FIREWALL, configuration is relatively simple, suitable for internet (Internet).

2. 1 Generally speaking, remoting is platform-related, requiring both clients and servers to be. NET, but the configurable features are better, and the protocol can be customized. web service can achieve cross-platform communication, but SOAP protocol must be adopted.

3. Soap messages come in rpc and document styles. The body element of the document style contains one or more elements, which can be anything as long as the recipient understands it. The rpc-style body element contains the name of the method or remote procedure being called and the element representing the method parameters.

The net implementations of both styles are web, service and remoting.

Generally speaking, the difference between Remoting and Web Services is:

(1) It supports both TCP channel and HTTP channel, and the transmission speed is fast
(2) Both SOAP packets of XML and binary streams can be transmitted with high efficiency
(3) Remoteing is mainly used in C/S structure project
(4) Do not rely on the IIS server

Thank you for reading, hope to help everyone, thank you for your support to this site!


Related articles: