- 浏览: 638592 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
sztime:
可以在文本框上绑定事件来禁用回车键, 我就是这样做的.在IE中 ...
form 回车自动提交问题 -
damoqiongqiu:
非常好的文章,很透彻不过有一句话小僧腆着脸补充一下:“1111 ...
为什么要用补码来做存储 -
wuyizhong:
原来如此啊。
form 回车自动提交问题 -
luliangy:
谢楼主~!
用C语言扩展Python的功能 -
kwong:
很有用,谢谢
火狐和IE 对css 样式解释的差异
一、什么是XML-RPC
xml-rpc 是一套允许运行在不同操作系统、不同环境的程序实现基于internet过程调用的规范和一系列的实现。
这种远程过程调用使用http作为传输协议,xml作为传送信息的编码格式。Xml-Rpc的定义尽可能的保持了简单,但同时能够传送、处理、返回复杂的数据结构。
Xml-rpc是工作在internet上的远程过程调用协议。一个xml-rpc消息就是一个请求体为xml的http-post请求,被调用的方法在服务器端执行并将执行结果以xml格式编码后返回。
- Request example
- Here's an example of an XML-RPC request:
- POST /RPC2 HTTP1.0
- User-Agent: Frontier5.1.2 (WinNT)
- Host: betty.userland.com
- Content-Type: textxml
- Content-length: 181
- <?xml version="1.0"?>
- <methodCall>
- <methodName>examples.getStateName</methodName>
- <params>
- <param>
- <value><i4>41</i4></value>
- </param>
- </params>
- </methodCall>
- Response example
- Here's an example of a response to an XML-RPC request:
- HTTP1.1 200 OK
- Connection: close
- Content-Length: 158
- Content-Type: textxml
- Date: Fri, 17 Jul 1998 19:55:08 GMT
- Server: UserLand Frontier5.1.2-WinNT
- <?xml version="1.0"?>
- <methodResponse>
- <params>
- <param>
- <value><string>South Dakota</string></value>
- </param>
- </params>
- </methodResponse>
二、xml-rpc入门程序
以下的入门程序包括一个管理器(HelloHandler)、一个服务器(HelloServer)、一个客户程序(HelloClient)。
首先要做的是创建用于远程过程调用的类和方法,人们常常称之为管理器。Xml-rpc管理器是一个方法和方法集,它接受xml-rpc请求,并对请求的内容进行解码,再向一个类和方法发出请求。
//管理器类
服务器程序将创建的管理器注册到服务器上,并为服务器指明应用程序其他特定的参数。
//服务器类
- package xmlRpc;
- /**
- *
- * <b><code>HelloServer</code></b> is a simple XML-RPC server
- * that will take the <code>HelloHandler</code> class available
- * for XML-PRC calls.
- *
- */
- import org.apache.xmlrpc.WebServer;
- import org.apache.xmlrpc.XmlRpc;
- import java.io.IOException;
- public class HelloServer {
- public static void main(String[] args){
- if(args.length<1){
- System.out.println("Usage: java HelloServer [port]");
- System.exit(-1);
- }
- try{
- XmlRpc.setDriver("org.apache.xerces.parsers.SAXParser");
- //start the server
- System.out.println("Starting XML-RPC Server......");
- WebServer server = new WebServer(Integer.parseInt(args[0]));
- //register our handler class
- server.addHandler("hello",new HelloHandler());
- System.out.println("Now accepting requests......");
- }catch(ClassNotFoundException e){
- System.out.println("Could not locate SAX Driver");
- }catch(IOException e){
- System.out.println("Could not start server: "+e.getMessage());
- }
- }
- }
- package xmlRpc;
- /**
- *
- * <b><code>HelloClient</code></b> is a simple XML-RPC client
- * that makes an XML-RPC request to <code>HelloServer</code>
- */
- import java.io.IOException;
- import java.util.Vector;
- import org.apache.xmlrpc.XmlRpc;
- import org.apache.xmlrpc.XmlRpcClient;
- import java.net.MalformedURLException;
- import org.apache.xmlrpc.XmlRpcException;
- public class HelloClient {
- public static void main(String[] args){
- if(args.length<1){
- System.out.println("Usage: java HelloClient [your name]");
- System.exit(-1);
- }
- try{
- //Use the Apache Xereces SAX Driver
- XmlRpc.setDriver("org.apache.xerces.parsers.SAXParser");
- //Specify the server
- XmlRpcClient client = new XmlRpcClient("http://localhost:8585");
- //create request
- Vector params = new Vector();
- params.addElement(args[0]);
- //make a request and print the result
- String result = (String)client.execute("hello.sayHello",params);
- System.out.println("Response from server: "+ result);
- }catch(ClassNotFoundException e){
- System.out.println("Could not locate SAX Driver");
- }catch(MalformedURLException e){
- System.out.println("Incorrect URL fro xml-rpc server foramt:"+e.getMessage());
- }catch(XmlRpcException e){
- System.out.println("XmlRpcException :"+e.getMessage());
- }catch(IOException e){
- System.out.println("IOException:"+e.getMessage());
- }
- }
- }
三、RPC和RMI的简单比较
在RMI和RPC之间最主要的区别在于方法是如何别调用的。在RMI中,远程接口使每个远程方法都具有方法签名。如果一个方法在服务器上执行,但是没有相匹配的签名被添加到这个远程接口上,那么这个新方法就不能被RMI客户方所调用。在RPC中,当一个请求到达RPC服务器时,这个请求就包含了一个参数集和一个文本值,通常形成“classname.methodname”的形式。这就向RPC服务器表明,被请求的方法在为“classname”的类中,名叫“methodname”。然后RPC服务器就去搜索与之相匹配的类和方法,并把它作为那种方法参数类型的输入。这里的参数类型是与RPC请求中的类型是匹配的。一旦匹配成功,这个方法就被调用了,其结果被编码后返回客户方。
trier 整理:
参考资料:
- http://www.xmlrpc.com/
《java&xml》O'Reilly
发表评论
-
foo, bar ,baz
2013-01-17 11:39 916这些术语本身相对于使用的场景来说没有任何意义。 ... -
网络游戏开发流程
2009-09-12 00:21 2387队伍组成 开发团队 ·制作人 ·执行制作人 ·策划 ... -
恭贺祖国生日快乐
2009-08-23 00:01 437美、加、日、德等国著名影星参演罕见经典国产巨片《建国大业》,以 ... -
网站体系架构演变
2009-05-26 00:28 557之前也有一些介绍大型 ... -
一个idea
2009-02-12 14:02 503http://www.coderecipes.cn/ http ... -
我的分析:sun什么时候会倒掉?【转载】
2008-12-30 09:39 566我不是在幸灾乐祸的看 ... -
需求与程序
2008-10-29 23:21 4611、要杀一个程序设计师不需要刀,改三次需求就好 ... -
常见 idc
2008-10-09 16:07 8001. 新网 http://www.xinnet.com 2. ... -
我是程序员,但是技术不应该是我的全部
2008-09-15 19:03 676八月十五长假就要 ... -
【智慧之言】爱因斯坦的建议
2008-08-18 13:00 1029阿尔伯特•爱因斯坦是20世纪最伟大的物理学家。他提出了很多的普 ... -
腾讯面试题
2008-08-12 09:24 2202一共有上下两排数,上排的十个数是【0,1,2,3,4,5,6, ... -
奥运趣谈
2008-08-04 22:28 639当前北京三种人:一、避运:外出旅游避开奥运。二、受运:留在北京 ... -
笑一笑 :)
2008-07-26 10:20 587数学女教师提问心不在焉的彼得。 女教师:“有三只鸟在电 ... -
不断的审视自己
2008-07-24 00:01 622钟伟要离职了,即在意料之外,又在情理之中。 本想接着项目的 ... -
谁来拯救中国3760亿美元财富
2008-07-16 11:34 254谁来拯救中国3760亿美元 ... -
卧撑“名人语录”
2008-07-09 18:53 6111.给我做三下俯卧撑,我也能推动地球。——阿基米得 2.如果我 ... -
强悍的父亲
2008-06-14 13:48 573爹跟儿子说:我要给你找个媳妇。 儿子说,可我愿意自己找! ... -
最不浪漫的17个人生片段
2008-06-12 22:02 6235岁时,适逢中秋,手拿一块月饼去找邻家小妹,想与她分享。不料 ... -
Learn list
2008-06-01 21:18 589感觉要学的东西很多很多,时间总是不够用,不能再东抓一下西抓一下 ... -
今天升级了笔记本
2008-05-01 17:53 617今天花了145¥ 买了个条子 升级了笔记本,剧爽中!!!把我所 ...
相关推荐
Apache xml-rpc入门详细的描述xmlrpc的开发过程,并带有例子。
NULL 博文链接:https://navylee.iteye.com/blog/723578
PHP中使用XML-RPC构造Web-Service简单入门.doc
PHP中使用XML-RPC构造Web_Service简单入门.doc
如果您只是入门,请务必参阅和。 安装 $ npm install grav.client 测验 # unit tests $ npm run test # end-to-end tests $ npm run test:e2e # test coverage $ npm run test:cov # acceptance tests $ npm run ...
站点的Web1.0的Web 2.0 (ajax, flex and flex-ws-amf) Web Services: SOAP / XML-RPC 通过JDBC驱动程序的数据库 ⽬录: LDAP ⾯向消息的服务通过JMS Service: POP3, IMAP, SMTP FTP 服务 等等其他协议
目前在三种主流的Web服务实现方案中,因为REST模式的Web服务与复杂的SOAP和XML-RPC对比来讲明显的更加简洁,越来越多的web服务开始采用REST风格设计和实现。例如,Amazon.com提供接近REST风格的Web服务进行图书查找...
20.9.6 基于XML-RPC Web服务 的wiki搜索和替换 440 20.10 SOAP 442 20.10.1 SOAP快速入门 442 20.10.2 SOAP请求 443 20.10.3 SOAP响应 444 20.10.4 错误处理机制 444 20.10.5 展示一个BittyWiki的 SOAP接口 445 ...
代码中既包含对Python中基础知识如字符串函数、字典、类和对象、迭代器、异常的简单使用,也包括10个基于Python的项目代码,包括及时标记、绘画、XML操作、即时通信、CGI远程、BBS、XML-RPC文件共享、基于GUI的文件...
| ├── zheng-upms-rpc-api -- rpc接口包 | ├── zheng-upms-rpc-service -- rpc服务提供者 | └── zheng-upms-server -- 用户权限系统及SSO服务端[端口:1111] ├── zheng-cms -- 内容管理系统 | ├── ...
发送XML-RPC Ping 支持Google API MySQL数据库管理 入门 安装Swift PHP 下载Swift PHP Framework,并将其解压缩到您的根目录中。 设置.htaccess 确保“ .htaccess”和“ index.php”文件位于同一公共目录中。 ...
gRPC-Java-RPC库和框架 gRPC-Java与JDK 7一起使用。Android API级别16及更高版本(Jelly Bean及更高版本)支持gRPC-Java客户端。 不支持在Android设备上部署gRPC服务器。 TLS使用通常需要使用Java 8或Android上的...
Python基础教程(第2版....第27章 项目8:使用XML-RPC进行文件共享 第28章 项目9:文件共享2——GUI版本 第29章 项目10:DIY街机游戏 附录A 简明版本 附录B Python参考手册 附录C 在线资源 附录D Python 3.0
XML-RPC — XML-RPC 函数 XMLReader — XMLReader functions XMLWriter — XMLWriter Functions XSL — XSL functions XSLT — XSLT Functions YAZ — YAZ Functions YP/NIS — YP/NIS Functions Zip — Zip File ...
XML-RPC — XML-RPC 函数 XMLReader — XMLReader functions XMLWriter — XMLWriter Functions XSL — XSL functions XSLT — XSLT Functions YAZ — YAZ Functions YP/NIS — YP/NIS Functions Zip — Zip File ...
XML-RPC 函数 CLVIII. XMLReader functions CLIX. XSL functions CLX. XSLT Functions CLXI. YAZ Functions CLXII. YP/NIS Functions CLXIII. Zip File Functions (Read Only Access) CLXIV. Zlib Compression ...
XML-RPC 函数 CLXIV. XMLReader functions CLXV. XSL functions CLXVI. XSLT Functions CLXVII. YAZ Functions CLXVIII. YP/NIS Functions CLXIX. Zip File Functions (Read Only Access) CLXX. Zlib Compression ...
JSON-RPC 客户端 API 通过 HTTP 的部分实现,具有功能 本地密钥管理 帐户和获得平衡 创建、签署和发送交易 依赖关系 Java 8 和 Gradle 5.6.4 入门 首先,最好安装最新的 JDK 和 Gradle。 安装 将以下 Maven 依赖项...
XML-RPC 函数 CLVIII. XMLReader functions CLIX. XSL functions CLX. XSLT Functions CLXI. YAZ Functions CLXII. YP/NIS Functions CLXIII. Zip File Functions (Read Only Access) CLXIV. Zlib Compression ...