分布式计算中WebService的替代方案: RPC (XML-RPC | JSON-RPC)

XML-RPC

http://zh.wikipedia.org/wiki/XML-RPC

XML-RPC是一个远程过程调用远端程序呼叫)(remote procedure call,RPC)的分布式计算协议,通过XML将调用函数封装,并使用HTTP协议作为传送机制[1]

.net中一个比较流行的实现是: xml-rpc.net
http://xml-rpc.net/faq/xmlrpcnetfaq-2-5-0.html

1. Introduction

1.1 What is XML-RPC?

To quote the XML-RPC.com site:

"It's a spec and a set of implementations that allow software running on disparate operating systems, running in different environments to make procedure calls over the Internet. It's remote procedure calling using HTTP as the transport and XML as the encoding. XML-RPC is designed to be as simple as possible, while allowing complex data structures to be transmitted, processed and returned.";

1.2 What is XML-RPC.NET?

XML-RPC.NET is a .NET class library for implementing XML-RPC clients and servers.

1.3 Why use XML-RPC instead of SOAP?

If your clients and servers are all running in the .NET environment there is no point in using XML-RPC: .NET provides excellent support for SOAP and XML-RPC doesn't have any features not provided by SOAP (other than simplicity).

If you use .NET clients and want to connect to XML-RPC servers running under any OS then XML-RPC.NET is a good choice.

If you want to implement a server in the .NET environment which is to be connected to by clients running in other environments, say Unix or Java, then XML-RPC may be an appropriate choice. SOAP is supported in many different environments but is considerably more complicated than XML-RPC and presents more opportunity for interop problems.

1.4 Where do I obtain XML-RPC.NET from?

XML-RPC.NET can be obtained from the XML-RPC.NET home page.

Updates are announced at Cook Computing and the Yahoo XMLRPCNET group.


JSON-RPC

JSON-RPC is a remote procedure call protocol encoded in JSON. It is a very simple protocol (and very similar to XML-RPC), defining only a handful of data types and commands. JSON-RPC allows for notifications (info sent to the server that does not require a response) and for multiple calls to be sent to the server which may be answered out of order.

.net中一个比较流行的实现:

http://jsonrpc2.codeplex.com/

Project Description
JSON-RPC.Net is a high performance Json-Rpc 2.0 server, leveraging the popular JSON.NET library. Host in ASP.NET, also supports sockets and pipes, oh my!

[Dot Net 4.0|Mono] currently Required. ASP.Net is optional.


工具: 监视端口数据

http://www.pocketsoap.com/tcptrace/

 listen on port:8081(这个端口号可以自己设定,只要没有被占用就行)。

destination server:loalhost(目标地址,我这里是本地)。

destination port:8080(目标端口,由上面的服务地址决定了这个端口是8080)。 

这样配置完成之后,我在浏览器中输入的访问地址中的端口就要变成8081,如:http://localhost:8081/springmvc/handle.do,

因为tcpTrace监听的是8081端口,他会把地址中的8081端口替换成目标端口8080.

原文地址:https://www.cnblogs.com/wucg/p/3307023.html