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" ); / / starttheserver System.out.println( "StartingXML-RPCServer......" ); WebServerserver = newWebServer(Integer.parseInt(args[ 0 ])); / / registerourhandlerclass server.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 { / / UsetheApacheXerecesSAXDriver XmlRpc.setDriver( "org.apache.xerces.parsers.SAXParser" ); / / Specifytheserver / / createrequest Vectorparams = newVector(); params.addElement(args[ 0 ]); / / makearequestandprinttheresult Stringresult = (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 ...
随机推荐
- Vue 缓存当前页面keep-alive
需求: 产品经理在列表页(几千个数据,n个page)点击某一项进去到详情页后,再返回到列表页发现页面回到了第一页,找不到之前的查看的是哪一条了,为了方便咋公司产品经理,返回列表页时需要记住之前的pag ...
- PS 实用技巧
1. 调整大小 ctrl + T 2. 导出透明背景图片 选择 png格式
- java的servlet执行过程是怎么样的?
java的servlet执行过程是怎么样 答: Servlet执行过程:程序第一次访问,会调用servlet的init()方法初始化(只执行一次),每次程序执行都会根据请求调用doGet()或者d ...
- query解决touchmove时屏蔽touchend
var dragging = false; $("li").on("touchmove",function(){ dragging = true; }); $( ...
- git:early EOF the remote end hung up unexpectedly index-pack failed RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
执行: git config http.sslVerify "false" 如果提示: fatal: not in a git directory 执行: git init
- dede织梦5.7的安全防护设置
dede安全是一直令人堪忧的,但是其用来建网站很方便,如果我们使用dede来建站,一定要做好安全防护工作. 下面总结一下dede织梦5.7的安全防护设置 1.更改管理员名称和密码,尽可能设置的复杂一下 ...
- spacemacs:emacs和vim结合,大杀器。vim党转emacs
结合本人基础,做下述结论.不一定准确. 基础: 1. vim操作和高级操作,熟悉.使用的spf13-vim. 2. emacs以前学过,但是按键太累,相比vim简直难受. 3. emacs命令 ...
- vue路由传参的三种方式
方式一 通过query方式传参 这种情况下 query传递的参数会显示在url后面 this.$router.push({ path: '/detail', query: { id: id } }) ...
- php 常用正则表达 邮箱 手机号啥的
class RegexConst { const REGEX_MOBLIE_86 = '/^1(3|4|5|7|8)\d{9}$/';//中国手机号 const REGEX_MOBLIE_852 = ...
- 在vue中使用axios发送post请求,参数方式
由于后台接收的参数格式为FormData格式, 在axios中参数格式默认为, 在传参数前,将原先官方提供的格式 改为如下: axios({ url: '../../../room/listRoomP ...