百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

dubbo-rpc-jsonrpc

> 编程语言
开源

Apache Dubbo 项目的 Json rpc 模块

193 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

Apache Dubbo 项目的 Json rpc 模块

Why HTTP

With the rapid iteration of the Internet, more and more companies choose quick script frameworks such as nodejs, Django and rails to develop web-side applications.

Java is the most suitable for back-end service, which resulting in a lot of cross-language invocation requirements.

While HTTP and JSON are naturally suitable as cross-language standards, all languages have mature class libraries for them.

Although Dubbo's asynchronous long connection protocol is efficient, in scripting languages this loss of efficiency is not important.

Why Not RESTful

Dubbo has made an attempt on the RESTful interface, but there is some difference between the REST architecture and the original RPC architecture of Dubbo.

The difference is that the REST architecture needs the definition of resources and we should operate the resources using the basic HTTP methods —— GET, POST, PUT, DELETE.

Dubbo needs to redefine the properties of the interface, which is a big burden on the original interface migration of Dubbo.

In contrast, RESTful is more appropriate for calls between Internet systems, and RPC is more appropriate for calls within a system, so we used JsonRPC which is more consistent with the Dubbo concept.

dubbo-rpc-jsonrpc

maven dependency:

xml

    com.qianmi
    dubbo-rpc-jsonrpc
    1.0.1

Configuration:

Define jsonrpc protocol:

xml
 

Set default protocol:

xml

Set service protocol:

xml

Multi port:

xml

Multi protocol:

xml
xml

Jetty Server: (default)

xml

or the latest version of jetty:

Maven:

xml

  org.mortbay.jetty
  jetty
  6.1.26

Servlet Bridge Server: (recommend)

xml

web.xml:

xml

         dubbo
         com.alibaba.dubbo.remoting.http.servlet.DispatcherServlet
         1

         dubbo
         /*

Be careful if you are using a servlet to send requests:

The protocol port must be the same as the port of the servlet container. The protocol context path must be the same as the servlet application context path.

CORS(Cross-origin resource sharing):

xml

	

Example

JAVA API

java
public interface PhoneNoCheckProvider {
    /**
     * check if the number is limited
     * @param operators  operators
     * @param no  number
     * @param userid  the user identity
     * */
    boolean isPhoneNoLimit(Operators operators, String no, String userid);
}

Client

bash
curl -i -H 'content-type: application/json' -X POST -d '{"jsonrpc": "2.0", "method": "isPhoneNoLimit", "params": [ "MOBILE", "130000", "A001"],
         "id": 1 }' 'http://127.0.0.1:18080/com.qianmi.api.PhoneNoCheckProvider'

Python Client Example

…

Python client

https://github.com/QianmiOpen/dubbo-client-py

Node.js client

https://github.com/QianmiOpen/dubbo-node-client

Examples for Client server

https://github.com/JoeCao/dubbo_jsonrpc_example
run with docker

Browser call

You need to enable CORS support as described above, see https://github.com/datagraph/jquery-jsonrpc

Documentation

JSON-RPC 2.0 Specification

jsonrpc4j

dubbo procotol

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Javadubbo

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言