XML-RPC-1概述
- 中文名
- XML-RPC
- 外文名
- XML Remote Procedure Call
- 属 于
- 标准通用标记语言
- 类 型
- 一个子集
目录
- 1 关于XML-RPC
- ▪ 基本介绍
- ▪ Request example
- ▪ Response example
- 2 XML-RPC入门程序
- ▪ 基本做法
- ▪ 管理器类
- ▪ 服务器类
- ▪ 客户程序
- 3 RPC和RMI的简单比较
- ▪ 调用形式
- ▪ classname.methodname的形式
- ▪ methodname
- ▪ 匹配成功后
关于XML-RPC
基本介绍
Request example
|
1
2
3
4
5
6
7
8
9
10
11
|
<?xmlversion="1.0"?><methodCall><methodName>examples.getStateName</methodName><params><param><value><i4>41</i4></value></param></params></methodCall> |
Response example
|
1
2
3
4
5
6
7
8
9
10
11
12
|
<?xmlversion="1.0"?><methodResponse><params><param><value><string>SouthDakota</string></value></param></params></methodResponse> |
XML-RPC入门程序
基本做法
管理器类
|
1
2
3
4
5
6
7
|
packagexmlRpc;/***@authortrier**<b><code>HelloHandler</code></b>isasimplehandlerthancan*beregisteredwithanXML-RPCserver*/publicclassHelloHandler{publicStringsayHello(Stringname){return"Hello"+name;}} |
服务器类
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
packagexmlRpc;/****<b><code>HelloServer</code></b>isasimpleXML-RPCserver*thatwilltakethe<code>HelloHandler</code>classavailable*forXML-PRCcalls.*<o:p*/importorg.apache.xmlrpc.WebServer;importorg.apache.xmlrpc.XmlRpc;importjava.IOException;publicclassHelloServer{publicstaticvoidmain(String[]args){if(args.length<1){System.out.println("Usage:javaHelloServer[port]");System.exit(-1);}try{XmlRpc.setDriver("org.apache.xerces.parsers.SAXParser");//starttheserverSystem.out.println("StartingXML-RPCServer......");WebServerserver=newWebServer(Integer.parseInt(args[0]));//registerourhandlerclassserver.addHandler("hello",newHelloHandler());System.out.println("Nowacceptingrequests......");}catch(ClassNotFoundExceptione){System.out.println("CouldnotlocateSAXDriver");}catch(IOExceptione){System.out.println("Couldnotstartserver:"+e.getMessage());}}} |
客户程序
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
packagexmlRpc;/****<b><code>HelloClient</code></b>isasimpleXML-RPCclient*thatmakesanXML-RPCrequestto<code>HelloServer</code>*/importjava.i.IOException;importjava.util.Vector;importorg.apache.xmlrpc.XmlRpc;importorg.apache.xmlrpc.XmlRpcClient;importjava.t.MalformedURLException;importorg.apache.xmlrpc.XmlRpcException;publicclassHelloClient{publicstaticvoidmain(String[]args){if(args.length<1){System.out.println("Usage:javaHelloClient[yourname]");System.exit(-1);}try{//UsetheApacheXerecesSAXDriverXmlRpc.setDriver("org.apache.xerces.parsers.SAXParser");//Specifytheserver//createrequestVectorparams=newVector();params.addElement(args[0]);//makearequestandprinttheresultStringresult=(String)client.execute("hello.sayHello",params);System.out.println("Responsefromserver:"+result);}catch(ClassNotFoundExceptione){System.out.println("CouldnotlocateSAXDriver");}catch(MalformedURLExceptione){System.out.println("IncorrectURLfroxml-rpcserverforamt:"+e.getMessage());}catch(XmlRpcExceptione){System.out.println("XmlRpcException:"+e.getMessage());}catch(IOExceptione){System.out.println("IOException:"+e.getMessage());}}} |
RPC和RMI的简单比较
调用形式
classname.methodname的形式
methodname
匹配成功后
XML-RPC-1概述的更多相关文章
- 什么是XML RPC?
# -*- coding: cp936 -*- #python 27 #xiaodeng #什么是XML RPC? #中文叫:远程过程调用 #使用http协议做传输协议的rpc机制,使用xml文本的方 ...
- The type javax.xml.rpc.ServiceException cannot be resolved.It is indirectly
The type javax.xml.rpc.ServiceException cannot be resolved.It is indirectly 博客分类: 解决方案_Java 问题描述:T ...
- 【PHP XML与dtd概述【完整版】】
一.XML文件简介 关于XML的大多数人都知道一些,HTML->xhtml->xml,这个顺序本来应当是HTML发展的顺序. XML可以当做配置文件使用,还可以充当小型的数据库. vers ...
- 关于XML的DTD概述
1 DTD概述 1.1 什么是DTD DTD(Document Type Definition),文档类型定义,用来约束XML文档.或者可以把DTD理解为创建XML文档的结构!例如可以用DTD要求XM ...
- xml rpc SimpleXMLRPCServer [python]
SimpleXMLRPCServe 其实里面xml的概念不是很强,主要是rpc !不用关心什么xml . rpc 是就是远程调用,把函数什么的放到远程服务器上,本地调用就行了.用 SimpleXMLR ...
- [03] mapper.xml的基本元素概述
1.select 我们基于这个持久层接口 GirlDao: public interface GirlDao { List<Girl> findByAge(int age); Girl f ...
- alluxio源码解析-rpc调用概述(1)
alluxio中几种角色以及角色之间的rpc调用: 作为分布式架构的文件缓存系统,rpc调用必不可少 client作为客户端 master提供thrift rpc的服务,管理以下信息: block信息 ...
- xml的解析(概述)
使用java解析xml☆☆☆ 四个类:分别是针对dom和sax解析使用的类 -dom : DocumentBuilder:解析器类 -这个类是个抽象类,不能new, ...
- Android之布局androidmanifest.xml 资源清单 概述
转载:https://www.cnblogs.com/wytings/p/4083463.html AndroidManifest.xml配置文件对于Android应用开发来说是比较细但又很重要的基础 ...
- supervisord支持扩展(xml RPC API & Third Party Applications and Libraries)
XML-RPC API Documentation http://www.supervisord.org/api.html Third Party Applications and Libraries ...
随机推荐
- SpringBoot缓存技术
一.SpringBoot整合Ehhcache 添加maven依赖 <dependency> <groupId>org.springframework.boot</grou ...
- Jupyter Notebook 远程连接配置(转载)
转载博客的Jupyter Notebook远程连接配置方法. 0 - 参考资料 https://www.jianshu.com/p/08f276d48669?utm_campaign=maleskin ...
- Vue+MySQL实现购物车的增删改查
1,创建简单数据库数据表 2,创建Mapper文件 <!--查询商品--> <select id="selectcommodity" resultType=&qu ...
- orcale11g安装
一.centos7.5安装orcale 安装环境 内存最小1G,推荐2G或者更高 内存为1-2g,swap是内存的1.5倍左右 内存大于2G, swap和内存相等 硬盘最小为30G oracle版本 ...
- 持续集成 Jenkins +Gitlab + SSH 自动发布 HTML 代码
目录 一.整体流程 二.Jenkins 配置 2.1.首先安装插件 2.2.配置目标服务器 2.3.创建 job 2.4.配置 gitlab 触发 三.改进 一.整体流程 二.Jenkins 配置 2 ...
- 《C语言程序设计教程》学习笔记
<C语言程序设计教程>--朱鸣华.刘旭麟等 第一章 C语言概述 1.C语言的特点: 1)兼具高级.低级语言的双重能力(C语言允许直接访问物理地址,能够进行位操作,能实现汇编语言的大部分功能 ...
- JS CSS写下拉菜单 竖行
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Lnamp的高级网站架构+动静分离+反向代理
Lnamp的架构 环境: 图上面是5台服务器 192.168.1.116 是nginx负载均衡+动静分离 192.168.1.117:linux+apache+php 192.168.1.118:li ...
- MySQL 事务一览
MySQL 中的事务? 对 MySQL 来说,事务通常是一组包含对数据库操作的集合.在执行时,只有在该组内的事务都执行成功,这个事务才算执行成功,否则就算失败.MySQL 中,事务支持是在引擎层实现的 ...
- [bzoj4665]小w的喜糖_二项式反演
小w的喜糖 题目链接:https://lydsy.com/JudgeOnline/problem.php?id=4665 数据范围:略. 题解: 二项式反演裸题. $f_{i,j}$表示,前$i$种钦 ...