The relationship between JSON-RPC, XML-RPC and SOAP

Source: Internet
Author: User
Tags anonymous soap

Turn from: http://kingquake21.iteye.com/blog/1033471


JSON-RPC Specification: Http://json-rpc.org/wiki/specification

XML-RPC Specification: Http://www.xmlrpc.com/spec

SOAP Specification: http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383487

Reference: http://weblog.masukomi.org/writings/xml-rpc_vs_soap.htm

All three are meant to implement message exchange in RPC, and no transport protocol is defined. However, in order to facilitate transmission in the network, and because of the stateless HTTP, HTTP is the common transport protocol for these three. The following example is also based on the HTTP protocol

XML-RPC and SOAP are both xml-based message exchange:

XML-RPC is very simple, defining several basic types, anonymous structures, anonymous arrays;

Soap can also customize types in addition to the basic type, named struct body, named array, and can use Polymorphic method invocation methods

While Json-rpc is a JSON-formatted message exchange, JSON is more lightweight than XML and is easy to use in page JS, and other features like XML-RPC

Here are some examples of sending requests using these protocols:

XML-RPC

XHTML Code POST/RPC2 http/1.0 user-agent:frontier/5.1.2 (WinNT) Host:betty.userland.com content-type:text/xml Co ntent-length:181 <?xml version= "1.0"?> <methodCall> <methodname>examples.getstatename </methodName> <params> <param> <value><i4>41</i4></value>            ; </param> </params> </methodCall>

Soap:

XHTML code   post /stockquote http/1.1   host: www.stockquoteserver.com   content-type: text/xml; charset= "Utf-8"    content-length: nnnn   SOAPAction:   "Some-uri"       <SOAP-ENV:Envelope     xmlns:soap-env= "http:// schemas.xmlsoap.org/soap/envelope/"     soap-env:encodingstyle=" http://schemas.xmlsoap.org/ soap/encoding/"/>      <SOAP-ENV:Header>           <t:Transaction               xmlns:t= "Some-uri"               soap-env : mustunderstand= "1" >                   5          </t:Transaction>      </soap-env:header>      <SOAP-ENV:Body>           <m:getlasttradeprice xmlns:m= "Some-uri" >               <symbol>DEF</symbol>           </m:GetLastTradePrice>      </SOAP-ENV:Body>    </SOAP-ENV:Envelope>  

Json:

JavaScript code--> {"Method": "echo", "params": ["Hello Json-rpc"], "id": 1} <--{"result": "Hello json-rpc", "ER Ror ": null," id ": 1}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.