XML-RPC HOWTO

Eric Kidd

Source Builders

<eric.kidd@pobox.com>

And Other Contributors

栰杮峗堦 - 擔杮岅東栿

            <hng@ps.ksky.ne.jp>
          

Copyright ? 2001 Eric Kidd

0.8.0, 2001-04-12

Revision History
Revision 0.8.0                           2001-04-12
Updated section on common interfaces. Added pointer to XML-RPC.Net
information.
Revision 0.7.0                           2001-04-03
Added section on C++ proxy classes.
Revision 0.6.0                           2001-02-02
Added sections on Ruby, K and common interfaces.
Revision 0.5.0                           2001-01-23
Initial version.

條乆側尵岅偱僋儔僀傾儞僩偍傛傃僒乕僶傪幚憰偡傞偨傔偺 XML-RPC 偺巊梡曽朄
傪弎傋傑偡丅椺戣偺僾儘僌儔儉偼 Perl, Python, C, C++, Java, PHP 偍傛傃懠
偺尵岅偱帵偟偰偄傑偡丅Zope 傗 KDE 2.0 偵偮偄偰傕埖偭偰偄傑偡丅XML-RPC
偺僒億乕僩偼偡傋偰偺僆儁儗乕僥傿儞僌僔僗僥儉偱棙梡偱偒傑偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

Table of Contents
1. Legal Notice
2. XML-RPC 偲偼丠

    2.1. 偳偺傛偆偵摦嶌偡傞偺偐
    2.2. 僒億乕僩偝傟傞僨乕僞偺庬暿
    2.3. XML-RPC 偺楌巎

3. XML-RPC 懳懠偺僾儘僩僐儖

    3.1. XML-RPC 懳 CORBA
    3.2. XML-RPC 懳 DCOM
    3.3. XML-RPC 懳 SOAP

4. 堦斒揑側 XML-RPC 僀儞僞乕僼僃乕僗

    4.1. 僀儞僩儘僗儁僋僔儑儞 - 僒乕僶偺 API 傪孈傝弌偡
    4.2. Boxcarring - 摨帪偵暋悢偺梫媮傪憲傞

5. API 偺帠椺 - sumAndDifference
6. Perl 偱偺 XML-RPC 偺巊偄曽

    6.1. Perl 僋儔僀傾儞僩
    6.2. 撈棫宆 Perl 僒乕僶
    6.3. CGI 儀乕僗偺 Perl 僒乕僶

7. Python 偱偺 XML-RPC 偺巊偄曽

    7.1. Python 僋儔僀傾儞僩

8. C 偍傛傃 C++ 偱偺 XML-RPC 偺巊偄曽

    8.1. C 僋儔僀傾儞僩
    8.2. C++ 僋儔僀傾儞僩
    8.3. 戙懼僋儔僗 (Proxy Class) 偱偺 C++ 僋儔僀傾儞僩
    8.4. CGI 儀乕僗偺 C 僒乕僶

9. Java 偱偺 XML-RPC 偺巊偄曽

    9.1. Java 僋儔僀傾儞僩
    9.2. 撈棫宆 Java 僒乕僶

10. PHP 偱偺 XML-RPC 偺巊偄曽

    10.1. PHP 僋儔僀傾儞僩
    10.2. PHP 僒乕僶

11. Microsoft .NET 偱偺 XML-RPC 偺巊偄曽
12. Ruby 偱偺 XML-RPC 偺巊偄曽

    12.1. Ruby 僋儔僀傾儞僩
    12.2. Ruby 僒乕僶

13. 撈帺揑側尵岅偱偺 XML-RPC 偺巊偄曽

    13.1. K 偱偺 XML-RPC 偺巊偄曽

14. XML-RPC 僒億乕僩偑慻傒崬傑傟偨傾僾儕働乕僔儑儞

    14.1. Zope
    14.2. KDE 2.0

15. 偙偺暥彂偵偮偄偰

    15.1. 偙偺暥彂偺怴斉
    15.2. XML-RPC HOWTO 偺婑峞幰
    15.3. 懠偺忣曬偺採弌

16. 擔杮岅栿偵偮偄偰

1. Legal Notice

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License <http://
www.fsf.org/copyleft/fdl.html>, Version 1.1 or any later version
published by the Free Software Foundation with no Invariant Sections,
no Front-Cover Texts, and no Back-Cover Texts. You may obtain a copy of
the GNU Free Documentation License from the Free Software Foundation by
visiting their Web site <http://www.fsf.org/> or by writing to: Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.

This manual contains short example programs ("the Software").
Permission is hereby granted, free of charge, to any person obtaining a
copy of the Software, to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following condition:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

2. XML-RPC 偲偼丠

XML-RPC <http://www.xmlrpc.com/> 偼 HTTP 忋偱儕儌乕僩庤懕偒屇傃弌偟傪峴
偆偨傔偺娙扨偱庤寉側曽朄偱偡丅Perl, Java, Python, C, C++, PHP 傗懡偔偺
懠偺僾儘僌儔儈儞僌尵岅偱巊梡偱偒傑偡丅Unix 偲 Windows, Macintosh 忋偱棙
梡壜擻偱偡丅

Perl 偱彂偐傟偨抁偄 XML-RPC 僋儔僀傾儞僩傪帵偟傑偡 (Ken MacLeod 偺
Frontier::Client <http://bitsko.slc.ut.us/~ken/xml-rpc/> 傪巊梡偟傑偡)
丅

use Frontier::Client;
$server = Frontier::Client->new(url => 'http://betty.userland.com/RPC2');
$name = $server->call('examples.getStateName', 41);
print "$name\n";

幚峴偡傞偲丄偙偺僾儘僌儔儉偼儕儌乕僩偺僒乕僶偵愙懕偟丄廈柤傪摼偰丄偦傟
傪昞帵偟傑偡 (偙偺椺偺廈斣崋 41 偼 South Dakota 偺偼偢偱偡)丅

Python 偱偺摨偠僾儘僌儔儉偱偡 (偙傟偱偼 Fredrik Lundh 偺 xmlrpclib
<http://www.pythonware.com/products/xmlrpc/> 傪巊偄傑偡)丅

python> import xmlrpclib
python> server = xmlrpclib.Server("http://betty.userland.com/RPC2")
python> server.examples.getStateName(41)
'South Dakota'

埲崀偺復偱偼丄條乆側尵岅偱 XML-RPC 僋儔僀傾儞僩偍傛傃僒乕僶偺彂偒曽傪妛
傃傑偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

2.1. 偳偺傛偆偵摦嶌偡傞偺偐

XML-RPC 偼 Dave Winer 偺岞幃巇條彂 <http://www.xmlrpc.com/spec>偱徻嵶偵
愢柧偝傟偰偄傑偡丅嫽枴偑偁傞側傜丄惀旕偛棗偵側偭偰偔偩偝偄丅娙寜偱柧夝
側暥彂偱偡丅

捠怣偡傞忋偱丄XML-RPC 偺抣偼 XML 偵僄儞僐乕僪偝傟傑偡 -

<methodCall>
  <methodName>sample.sumAndDifference</methodName>
  <params>
    <param><value><int>5</int></value></param>
    <param><value><int>3</int></value></param>
  </params>
</methodCall>

忋婰偼忕挿偱偡偑丄娙扨偵埑弅偱偒傑偡丅傑偨丄梊憐埲忋偵懍偄偱偡 - Rick
Blair 偺應掕偵傛傟偽丄Hannes Walln fer 偺 Java 偱偺幚憰傪巊偆偲 XML-RPC
屇傃弌偟偺墳摎帪娫偼 3 儈儕昩偱偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

2.2. 僒億乕僩偝傟傞僨乕僞偺庬暿

XML-RPC 偼埲壓偺僨乕僞偺庬暿傪僒億乕僩偟傑偡丅

int

    晞崋晅 32 價僢僩惍悢

string

    ASCII 暥帤楍偱嬻僶僀僩傕嫋偝傟傑偡丅(幚嵺偵偼偨偔偝傫偺 XML-RPC 偺
    幚憰偑 Unicode 傪僒億乕僩偟偰偄傑偡丅XML 偺婎杮婡擻偵姶幱丅)

boolean

    恀偐婾偺偳偪傜偐

double

    攞惛搙晜摦彫悢揰幚悢 (幚嵺偵偼偄偔偮偐偺幚憰偱巊偊側偄偐傕偟傟傑偣
    傫)

dateTime.iso8601

    擔晅偲帪崗丅巆擮側偑傜丄XML-RPC 偼僞僀儉僝乕儞偺巊梡傪嬛巭偟偰偄傞
    偺偱丄偙傟偼傎偲傫偳栶偵棫偪傑偣傫丅

base64

    擟堄挿偺惗偺僶僀僫儕僨乕僞 - 捠怣忋 Base64 傪巊梡偟偰僄儞僐乕僪偝傟
    傑偡丅偲偰傕栶棫偪傑偡 (偗傟偳傕偄偔偮偐偺幚憰偱偼 0 僶僀僩偺僨乕僞
    庴怣偑峴偊傑偣傫)丅

array

    抣偺堦師尦攝楍丅屄乆偺抣偼偳傫側庬暿偱傕偐傑偄傑偣傫

struct

    僉乕偲抣偺廤傑傝丅僉乕偼暥帤楍偱偡 - 抣偼偳傫側庬暿偱傕偐傑偄傑偣傫
    丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

2.3. XML-RPC 偺楌巎

XML-RPC 偼丄愭峴偡傞擇偮偺僾儘僩僐儖偐傜拝憐傪摼偰偄傑偡丅偦偺堦偮偼丄
anonymous RPC 偱偁傝丄偙傟偼 Dave Winer 偵傛傝愝寁偝傟丄夁嫀偵 DaveNet
偱偺僄僢僙僀 <http://davenet.userland.com/1998/02/27/rpcOverHttpViaXml>
偲偟偰敪昞偝傟偨傕偺偱偡 (XML-RPC 僒乕僶偑 /RPC2 壓偵僀儞僗僩乕儖偝傟傞
偙偲偑懡偄偺偼偙偺偨傔偱偡)丅傕偆堦偮偺丄傛傝廳梫側拝憐偼丄SOAP 僾儘僩
僐儖偺弶婜僪儔僼僩偵傛傞傕偺偱偡丅

傛傝徻偟偄 XML-RPC 偺楌巎 <http://www.xmlrpc.com/stories/
storyReader$555>偲偄偆暥彂傪 Dave Winer 偑採嫙偟偰偔傟偰偄傑偡丅偙偺暥
彂偱偼丄XML-RPC 偲 SOAP 偲偺娭學偵偮偄偰傕愢柧偝傟偰偄傑偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

3. XML-RPC 懳懠偺僾儘僩僐儖

儕儌乕僩庤懕偒屇傃弌偟偼 XML-RPC 偑桞堦偺曽朄偱偼偁傝傑偣傫丅恖婥偺偁傞
懠偺僾儘僩僐儖偵偼 CORBA, DCOM, SOAP 側偳偑偁傝傑偡丅奺僾儘僩僐儖偵偼挿
強偲抁強偑偁傝傑偡丅

偙偺復偱偺堄尒偵偼丄(挊幰偺) 柧傜偐側曃尒傕娷傑傟偰偄傑偡丅偳偆偐丄偦偺
揰傪峫椂偟偰偍撉傒偔偩偝偄丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

3.1. XML-RPC 懳 CORBA

CORBA <http://www.corba.org/> 偼恖婥偺偁傞僾儘僩僐儖偱丄暘嶶宆僆僽僕僃
僋僩巜岦傾僾儕働乕僔儑儞岦偗偵彂偐傟偰偄傑偡丅堦斒揑偵暋悢偺憌傪帩偮僄
儞僞乕僾儔僀僘傾僾儕働乕僔儑儞偱巊梡偝傟傑偡丅嵟嬤偱偼丄傾僾儕働乕僔儑
儞娫捠怣梡偵傕 Gnome <http://www.gnome.org/> 僾儘僕僃僋僩偵傛偭偰慖掕偝
傟偰偄傑偡丅

CORBA 偼懡偔偺儀儞僟乕傗偨偔偝傫偺僼儕乕僜僼僩僂僃傾僾儘僕僃僋僩偵傛傝
丄傛偔僒億乕僩偝傟偰偄傑偡丅CORBA 偼 Java, C++ 偲偆傑偔摦嶌偟丄懡偔偺懠
偺尵岅偐傜傕棙梡壜擻偱偡丅偝傜偵 CORBA 偼桪傟偨 interface definition
language (IDL) 傪採嫙偟丄撉傒傗偡偄僆僽僕僃僋僩巜岦 API 傪掕媊偱偒傞傛
偆偵偟傑偡丅

巆擮側偙偲偵丄CORBA 偼偲偰傕暋嶨偱偡丅妛廗嬋慄偼媫岡攝偲側偭偰偄偰丄幚
憰偡傞偺偵旕忢側搘椡傪昁梫偲偟丄偐側傝崅搙側僋儔僀傾儞僩傪昁梫偲偟傑偡
丅暘嶶宆僂僃僽傾僾儕働乕僔儑儞傛傝傕僄儞僞乕僾儔僀僘傗僨僗僋僩僢僾傾僾
儕働乕僔儑儞偵堦斣揔偟偰偄傑偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

3.2. XML-RPC 懳 DCOM

DCOM <http://www.microsoft.com/com/tech/DCOM.asp> 偼 CORBA 偵懳偡傞
Microsoft 偺摎偊偱偡丅偡偱偵 COM 僐儞億乕僱儞僩傪巊梡偟偰偄偰 Microsoft
埲奜偺僔僗僥儉偲傗傝庢傝偡傞昁梫偑側偗傟偽丄慺惏傜偟偄傕偺偱偡丅偦偆偱
側偗傟偽丄偁傑傝栶偵棫偨側偄偱偟傚偆丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

3.3. XML-RPC 懳 SOAP

SOAP <http://www.w3.org/TR/SOAP/> 偼偲偰傕 XML-RPC 偵帡偰偄傑偡丅XML 暥
彂偺傑傑丄HTTP 忋偱惍楍偟偨庤懕偒屇傃弌偟傪峴偆摦嶌傕帡偰偄傑偡丅巆擮側
偑傜 SOAP 偼巇條偺妋掕偵擸傫偱偄傞傛偆偵尒偊傑偡丅

SOAP 偼尦乆 UserLand, DevelopMentor, Microsoft 偺嫟摨惂嶌偵傛傝嶌惉偝傟
傑偟偨丅嵟弶偺岞偺儕儕乕僗偼婎杮揑偵僱乕儉僗儁乕僗偲挿偄僄儗儊儞僩柤傪
帩偮 XML-RPC 偱偟偨丅偟偐偟偦偺屻 SOAP 偼 W3C 儚乕僉儞僌僌儖乕僾偵堷偒
宲偑傟傑偟偨丅

巆擮側偙偲偵丄儚乕僉儞僌僌儖乕僾偼 SOAP偵偲偰傕懡偔偺晄壜夝側婡擻偺捛壛
傪峴偭偰偄傑偡丅偙偺暥彂偺幏昅帪揰偱丄SOAP 偼 XML 僗僉乕儉丄僄儈儏儗乕
僔儑儞丄婏柇側暋崌峔憿懱偍傛傃攝楍丄偦偟偰僇僗僞儉僞僀僾傪僒億乕僩偟偰
偄傑偡丅壛偊偰丄偄偔偮傕偺 SOAP 偺奜晹巇條偺幚憰傕掕媊偝傟偰偄傑偡丅

婎杮揑偵 XML-RPC 偑岲偒偱偁傞偗傟偳傕偭偲偨偔偝傫偺婡擻傪帩偭偨僾儘僩僐
儖傪朷傓応崌丄SOAP 傪挷嵏偡傞偲偄偄偱偟傚偆丅 :-)

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

4. 堦斒揑側 XML-RPC 僀儞僞乕僼僃乕僗

偄偔偮偐偺 XML-RPC 僒乕僶偼價儖僩僀儞儊僜僢僪傪採嫙偟傑偡丅偦傟傜偼
XML-RPC 偦傟帺恎偺傕偺偱偼偁傝傑偣傫偑丄偲偰傕曋棙側捛壛婡擻偱偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

4.1. 僀儞僩儘僗儁僋僔儑儞 - 僒乕僶偺 API 傪孈傝弌偡

Edd Dumbill 偼師偺儊僜僢僪偺慻傒傪採埬 <http://xmlrpc.usefulinc.com/doc
/reserved.html>偟傑偟偨丅

array system.listMethods ()
string system.methodHelp (string methodName)
array system.methodSignature (string methodName)

僒乕僶偑偙傟傜偺儊僜僢僪傪僒億乕僩偡傞応崌丄偁傞僪僉儏儊儞僥乕僔儑儞傪
報帤偡傞偨傔偵僒乕僶傊栤偄崌傢偣偑偱偒傑偡 -

import xmlrpclib
server = xmlrpclib.Server("http://xmlrpc-c.sourceforge.net/api/sample.php")
for method in server.system.listMethods():
    print method
    print server.system.methodHelp(method)
    print

偙傟傜偺儊僜僢僪偼 PHP 偍傛傃 C丄Microsoft .NET 偱彂偐傟偨僒乕僶偵傛傝
僒億乕僩偝傟偰偄傑偡丅晹暘揑側僀儞僩儘僗儁僋僔儑儞偺僒億乕僩偼嵟嬤偵側
偭偰 UserLand Frontier 偵傕慻傒崬傑傟偰偄傑偡丅Perl 偍傛傃 Python, Java
梡偺僀儞僩儘僗儁僋僔儑儞偺僒億乕僩偼 XML-RPC Hacks <http://
xmlrpc-c.sourceforge.net/hacks.php> 偺儁乕僕偱擖庤偱偒傑偡丅偳偆偧丄墦
椂側偔僀儞僩儘僗儁僋僔儑儞偺僒億乕僩傪懠偺 XML-RPC 僒乕僶偵捛壛偟偰偔偩
偝偄両

條乆側僋儔僀傾儞僩懁偺僣乕儖 (僪僉儏儊儞僥乕僔儑儞丄儔僢僷乕惗惉摍摍)
傕 XML-RPC Hacks 偺儁乕僕偱尒偮偗傜傟傑偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

4.2. Boxcarring - 摨帪偵暋悢偺梫媮傪憲傞

懡偔偺僼傽儞僋僔儑儞僐乕儖傪偡傞 XML-RPC 僋儔僀傾儞僩傪彂偄偰偄傞側傜丄
僀儞僞乕僱僢僩偺僶僢僋儃乕儞偺儗乕僥儞僔乕 (懸偪帪娫) 偑抁偄偍偐偘偱丄
墳摎帪娫偑偐側傝懍偄偙偲傪婥偯偔偐傕偟傟傑偣傫丅偄偔偮偐偺僒乕僶偼師偺
婡擻傪巊偆偙偲偱暋悢偺梫媮傪堦妵張棟 (batching) 偱偒傑偡丅

array system.multicall (array calls)

捛壛忣曬偼 system.multicall RFC <http://www.xmlrpc.com/discuss/
msgReader$1208> 傛傝摼偰偔偩偝偄丅

尰嵼丄偙偺儊僜僢僪偼 C 偍傛傃 UserLand Frontier 偱彂偐傟偨僒乕僶偱僒億
乕僩偝傟偰偄傑偡丅Python 偍傛傃 Perl 偱彂偐傟偨僒乕僶偼 XML-RPC Hacks
<http://xmlrpc-c.sourceforge.net/hacks.php> 偺儁乕僕偵偁傞僾儘僌儔儉傪
棙梡偱偒傑偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

5. API 偺帠椺 - sumAndDifference

XML-RPC 偺僨儌傪偡傞偨傔偵丄壜擻側尷傝懡偔偺尵岅偱埲壓偵帵偟傑偡丅

struct sample.sumAndDifference (int x, int y)

偙偺娭悢偼堷偒悢偲偟偰擇偮偺惍悢傪庴偗庢偭偰丄擇偮偺僄儗儊儞僩傪帩偮
XML-RPC <struct(峔憿懱)> 傪栠偟傑偡 -

sum

    擇偮偺惍悢偺榓

difference

    擇偮偺惍悢偺嵎

幚梡揑側傕偺偱偼偁傝傑偣傫偑丄棫攈側椺戣偵側偭偰偄傑偡 :-)

偙偺娭悢 (傗懠偺傕偺) 偼 URL http://xmlrpc-c.sourceforge.net/api/
sample.php 傪棙梡偟偰偄傑偡 (偙偺 URL 偼僽儔僂僓偱偼壗傕偱偒偢丄XML-RPC
僋儔僀傾儞僩偱棙梡偱偒傑偡)丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

6. Perl 偱偺 XML-RPC 偺巊偄曽

Ken MacLeod 偼 Perl 梡 XML-RPC 傪幚憰偟偰偄傑偡丅斵偺 Frontier::RPC 儌
僕儏乕儖偼斵偺僂僃僽僒僀僩 <http://bitsko.slc.ut.us/~ken/xml-rpc/>傕偟
偔偼 CPAN <http://www.cpan.org/> 傪捠偠偰擖庤偱偒傑偡丅

Frontier::RPC 傪僀儞僗僩乕儖偡傞偵偼丄昗弨揑側傗傝曽偱僷僢働乕僕傪僟僂
儞儘乕僪偟偰僐儞僷僀儖偟傑偡 -

bash$ gunzip -c Frontier-RPC-0.07b1.tar.gz | tar xvf -
bash$ cd Frontier-RPC-0.07b1
bash$ perl Makefile.PL
bash$ make
bash$ make test
bash$ su -c 'make install'

(僂傿儞僪僂娐嫬傗儖乕僩尃尷偺柍偄応崌丄傢偢偐偵堘偭偨庤弴偲側傞偱偟傚偆
丅徻嵶偼 Perl 偺暥彂傪嶲峫偵偟偰偔偩偝偄丅)

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

6.1. Perl 僋儔僀傾儞僩

師偺僾儘僌儔儉偼 Perl 偐傜 XML-RPC 僒乕僶偺僐乕儖偺曽朄傪帵偟傑偡丅

use Frontier::Client;

# Make an object to represent the XML-RPC server.
$server_url = 'http://xmlrpc-c.sourceforge.net/api/sample.php';
$server = Frontier::Client->new(url => $server_url);

# Call the remote server and get our result.
$result = $server->call('sample.sumAndDifference', 5, 3);
$sum = $result->{'sum'};
$difference = $result->{'difference'};

print "Sum: $sum, Difference: $difference\n";

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

6.2. 撈棫宆 Perl 僒乕僶

師偺僾儘僌儔儉偼 Perl 偱偺 XML-RPC 僒乕僶偺彂偒曽傪帵偟傑偡丅

use Frontier::Daemon;

sub sumAndDifference {
    my ($x, $y) = @_;
    return {'sum' => $x + $y, 'difference' => $x - $y};
}

# Call me as http://localhost:8080/RPC2
$methods = {'sample.sumAndDifference' => \&sumAndDifference};
Frontier::Daemon->new(LocalPort => 8080, methods => $methods)
    or die "Couldn't start HTTP server: $!";

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

6.3. CGI 儀乕僗偺 Perl 僒乕僶

Frontier::RPC2 偼 CGI 儀乕僗僒乕僶梡偺僒億乕僩偼杮棃旛偊傜傟偰偄傑偣傫
丅偟偐偟戝忎晇丄昁梫側傎偲傫偳偺婡擻偼梡堄偝傟偰偄傑偡丅

師偺僾儘僌儔儉僐乕僪傪 sumAndDifference.cgi 偲偟偰丄僂僃僽僒乕僶偺
cgi-bin 僨傿儗僋僩儕偵曐懚偟偰偔偩偝偄 (Unix 僔僗僥儉忋偱丄chmod +x
sumAndDifference.cgi 偲擖椡偟丄幚峴懏惈傪梌偊傞昁梫偑偁傞偱偟傚偆)丅

#!/usr/bin/perl -w

use strict;
use Frontier::RPC2;

sub sumAndDifference {
    my ($x, $y) = @_;
    return {'sum' => $x + $y, 'difference' => $x - $y};
}

process_cgi_call({'sample.sumAndDifference' => \&sumAndDifference});

#==========================================================================
#  CGI Support
#==========================================================================
#  Simple CGI support for Frontier::RPC2. You can copy this into your CGI
#  scripts verbatim, or you can package it into a library.
#  (Based on xmlrpc_cgi.c by Eric Kidd <http://xmlrpc-c.sourceforge.net/>.)

# Process a CGI call.
sub process_cgi_call ($) {
    my ($methods) = @_;

    # Get our CGI request information.
    my $method = $ENV{'REQUEST_METHOD'};
    my $type = $ENV{'CONTENT_TYPE'};
    my $length = $ENV{'CONTENT_LENGTH'};

    # Perform some sanity checks.
    http_error(405, "Method Not Allowed") unless $method eq "POST";
    http_error(400, "Bad Request") unless $type eq "text/xml";
    http_error(411, "Length Required") unless $length > 0;

    # Fetch our body.
    my $body;
    my $count = read STDIN, $body, $length;
    http_error(400, "Bad Request") unless $count == $length;

    # Serve our request.
    my $coder = Frontier::RPC2->new;
    send_xml($coder->serve($body, $methods));
}

# Send an HTTP error and exit.
sub http_error ($$) {
    my ($code, $message) = @_;
    print <<"EOD";
Status: $code $message
Content-type: text/html

<title>$code $message</title>
<h1>$code $message</h1>
<p>Unexpected error processing XML-RPC request.</p>
EOD
    exit 0;
}

# Send an XML document (but don't exit).
sub send_xml ($) {
    my ($xml_string) = @_;
    my $length = length($xml_string);
    print <<"EOD";
Status: 200 OK
Content-type: text/xml

EOD
    # We want precise control over whitespace here.
    print $xml_string;
}

偁側偨帺恎偺 CGI 僗僋儕僾僩偵儐乕僥傿儕僥傿儖乕僠儞傪僐僺乕偟偰傕偐傑偄
傑偣傫丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

7. Python 偱偺 XML-RPC 偺巊偄曽

Fredrik Lundh 偼桪傟偨Python 梡 XML-RPC 儔僀僽儔儕 <http://
www.pythonware.com/products/xmlrpc/>傪採嫙偟偰偄傑偡丅

僀儞僗僩乕儖偡傞偨傔偵丄嵟怴斉傪僟僂儞儘乕僪偟偰偔偩偝偄丅 *.py 僼傽僀
儖傪屄恖偺 Python 僾儘僌儔儉偲偟偰丄屄恖偺僨傿儗僋僩儕偵撍偭崬傫偱傕丄
僔僗僥儉偺 Python 僨傿儗僋僩儕偵僀儞僗僩乕儖偟偰傕偐傑偄傑偣傫丅

RedHat 6.2 偺儐乕僓偼師偺傛偆偵擖椡偟傑偡丅

bash$ mkdir xmlrpclib-0.9.8
bash$ cd xmlrpclib-0.9.8
bash$ unzip ../xmlrpc-0.9.8-990621.zip
bash$ python
python> import xmlrpclib
python> import xmlrpcserver
python> Control-D
bash$ su -c 'cp *.py *.pyc /usr/lib/python1.5/'

忋婰偱偼丄Python 偵擇偮偺 *.py 傪僐儞僷僀儖偝偣傞偨傔偵丄偦傟傜傪
import 偟偰偄傑偡丅懠偺僾儔僢僩僼僅乕儉偱偼 Python 偺暥彂傪嶲峫偵偟偰偔
偩偝偄丅

偝傜懡偔偺 Python 偱偺椺偵娭偟偰偼丄O'Reilly network 偺 XML-RPC: It
Works Both Ways <http://www.oreillynet.com/pub/a/python/2001/01/17/
xmlrpcserver.html> 偺婰帠傪傒偰偔偩偝偄丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

7.1. Python 僋儔僀傾儞僩

師偺僾儘僌儔儉偼 Python 偐傜 XML-RPC 僒乕僶偺僐乕儖偺曽朄傪帵偟傑偡丅

import xmlrpclib

# Create an object to represent our server.
server_url = 'http://xmlrpc-c.sourceforge.net/api/sample.php';
server = xmlrpclib.Server(server_url);

# Call the server and get our result.
result = server.sample.sumAndDifference(5, 3)
print "Sum:", result['sum']
print "Difference:", result['difference']

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

8. C 偍傛傃 C++ 偱偺 XML-RPC 偺巊偄曽

C/C++ 梡 XML-RPC 偺僐僺乕傪摼傞偵偼丄xmlrpc-c 偺僂僃僽僒僀僩 <http://
xmlrpc-c.sourceforge.net>傪尒偰偔偩偝偄丅

RPM 宍幃偱偡傋偰偺傕偺傪僟僂儞儘乕僪偡傞偙偲傕丄僜乕僗偐傜帺暘偱娐嫬傪
峔抸偡傞偙偲傕偱偒傑偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

8.1. C 僋儔僀傾儞僩

師偺僾儘僌儔儉僐乕僪傪 getSumAndDifference.c 偲偟偰僼傽僀儖偵曐懚偟偰偔
偩偝偄丅

#include <stdio.h>
#include <xmlrpc.h>
#include <xmlrpc_client.h>

#define NAME       "XML-RPC getSumAndDifference C Client"
#define VERSION    "0.1"
#define SERVER_URL "http://xmlrpc-c.sourceforge.net/api/sample.php"

void die_if_fault_occurred (xmlrpc_env *env)
{
    /* Check our error-handling environment for an XML-RPC fault. */
    if (env->fault_occurred) {
        fprintf(stderr, "XML-RPC Fault: %s (%d)\n",
                env->fault_string, env->fault_code);
        exit(1);
    }
}

int main (int argc, char** argv)
{
    xmlrpc_env env;
    xmlrpc_value *result;
    xmlrpc_int32 sum, difference;

    /* Start up our XML-RPC client library. */
    xmlrpc_client_init(XMLRPC_CLIENT_NO_FLAGS, NAME, VERSION);
    xmlrpc_env_init(&env);

    /* Call our XML-RPC server. */
    result = xmlrpc_client_call(&env, SERVER_URL,
                                "sample.sumAndDifference", "(ii)",
                                (xmlrpc_int32) 5,
                                (xmlrpc_int32) 3);
    die_if_fault_occurred(&env);

    /* Parse our result value. */
    xmlrpc_parse_value(&env, result, "{s:i,s:i,*}",
                       "sum", &sum,
                       "difference", &difference);
    die_if_fault_occurred(&env);

    /* Print out our sum and difference. */
    printf("Sum: %d, Difference: %d\n", (int) sum, (int) difference);

    /* Dispose of our result value. */
    xmlrpc_DECREF(result);

    /* Shutdown our XML-RPC client library. */
    xmlrpc_env_clean(&env);
    xmlrpc_client_cleanup();

    return 0;
}

僐儞僷僀儖偡傞偨傔偺擖椡傪帵偟傑偡 -

bash$ CLIENT_CFLAGS=`xmlrpc-c-config libwww-client --cflags`
bash$ CLIENT_LIBS=`xmlrpc-c-config libwww-client --libs`
bash$ gcc $CLIENT_CFLAGS -o getSumAndDifference getSumAndDifference.c $CLIENT_LIBS

偁側偨偺僔僗僥儉偺 C 僐儞僷僀儔偺柤慜偑 gcc 偱偼側偄偐傕偟傟側偄偺偱丄
幚嵺偺擖椡偱偼偦傟傪戙偊傞昁梫偑偁傞偐傕偟傟傑偣傫丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

8.2. C++ 僋儔僀傾儞僩

師偺僾儘僌儔儉僐乕僪傪 getSumAndDifference2.cc 偲偟偰僼傽僀儖偵曐懚偟偰
偔偩偝偄丅

#include <iostream.h>
#include <XmlRpcCpp.h>

#define NAME       "XML-RPC getSumAndDifference C++ Client"
#define VERSION    "0.1"
#define SERVER_URL "http://xmlrpc-c.sourceforge.net/api/sample.php"

static void get_sum_and_difference () {

    // Build our parameter array.
    XmlRpcValue param_array = XmlRpcValue::makeArray();
    param_array.arrayAppendItem(XmlRpcValue::makeInt(5));
    param_array.arrayAppendItem(XmlRpcValue::makeInt(3));

    // Create an object to resprent the server, and make our call.
    XmlRpcClient server (SERVER_URL);
    XmlRpcValue result = server.call("sample.sumAndDifference", param_array);

    // Extract the sum and difference from our struct.
    XmlRpcValue::int32 sum = result.structGetValue("sum").getInt();
    XmlRpcValue::int32 diff = result.structGetValue("difference").getInt();

    cout << "Sum: " << sum << ", Difference: " << diff << endl;
}

int main (int argc, char **argv) {

    // Start up our client library.
    XmlRpcClient::Initialize(NAME, VERSION);

    // Call our client routine, and watch out for faults.
    try {
        get_sum_and_difference();
    } catch (XmlRpcFault& fault) {
        cerr << argv[0] << ": XML-RPC fault #" << fault.getFaultCode()
             << ": " << fault.getFaultString() << endl;
        XmlRpcClient::Terminate();
        exit(1);
    }

    // Shut down our client library.
    XmlRpcClient::Terminate();
    return 0;
}

僐儞僷僀儖偡傞偨傔偺擖椡傪帵偟傑偡 -

bash$ CLIENT_CFLAGS=`xmlrpc-c-config c++ libwww-client --cflags`
bash$ CLIENT_LIBS=`xmlrpc-c-config c++ libwww-client --libs`
bash$ c++ $CLIENT_CFLAGS -o getSumAndDifference2 getSumAndDifference2.cc $CLIENT_LIBS

偙偺嶌嬈偺偨傔偵丄偐側傝嵟嬤偺 C++ 僐儞僷僀儔偑昁梫偲側傝傑偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

8.3. 戙懼僋儔僗 (Proxy Class) 偱偺 C++ 僋儔僀傾儞僩

XML-RPC 僒乕僶偑僀儞僩儘僗儁僋僔儑儞 API 傪僒億乕僩偟偰偄傞側傜丄帺摦揑
偵偦偺僒乕僶梡偺 C++ 戙懼僋儔僗傪惗惉偱偒傑偡丅戙懼僋儔僗傪惗惉偡傞偨傔
偵偼丄師偺僐儅儞僪傪擖椡偟偰偦偺弌椡傪僼傽僀儖偵曐懚偟偰偔偩偝偄丅

bash$ xml-rpc-api2cpp \
> http://xmlrpc-c.sourceforge.net/api/sample.php sample SampleProxy

偙傟偼 sample 偱巒傑傞偡傋偰偺儊僜僢僪梡偺儔僢僷乕偑娷傑傟偰偄傞
SampleProxy 偲柤偯偗傜傟偨戙懼僋儔僗傪惗惉偟傑偡丅偁側偨偑朷傓曽朄偱偙
偺僋儔僗傪廋惓偟偰傕偐傑偄傑偣傫丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

8.4. CGI 儀乕僗偺 C 僒乕僶

師偺僾儘僌儔儉僐乕僪傪 sumAndDifference.c 偲偟偰僼傽僀儖偵曐懚偟偰偔偩
偝偄丅

#include <xmlrpc.h>
#include <xmlrpc_cgi.h>

xmlrpc_value *
sumAndDifference (xmlrpc_env *env, xmlrpc_value *param_array, void *user_data)
{
    xmlrpc_int32 x, y;

    /* Parse our argument array. */
    xmlrpc_parse_value(env, param_array, "(ii)", &x, &y);
    if (env->fault_occurred)
        return NULL;

    /* Return our result. */
    return xmlrpc_build_value(env, "{s:i,s:i}",
                              "sum", x + y,
                              "difference", x - y);
}

int main (int argc, char **argv)
{
    /* Set up our CGI library. */
    xmlrpc_cgi_init(XMLRPC_CGI_NO_FLAGS);

    /* Install our only method (with a method signature and a help string). */
    xmlrpc_cgi_add_method_w_doc("sample.sumAndDifference",
                                &sumAndDifference, NULL,
                                "S:ii", "Add and subtract two integers.");

    /* Call the appropriate method. */
    xmlrpc_cgi_process_call();

    /* Clean up our CGI library. */
    xmlrpc_cgi_cleanup();
}

僐儞僷僀儖偡傞偨傔偺擖椡傪帵偟傑偡 -

bash$ CGI_CFLAGS=`xmlrpc-c-config cgi-server --cflags`
bash$ CGI_LIBS=`xmlrpc-c-config cgi-server --libs`
bash$ gcc $CGI_CFLAGS -o sumAndDifference.cgi sumAndDifference.c $CGI_LIBS

偙傟偑廔椆偟偨傜丄sumAndDifference.cgi 傪僂僃僽僒乕僶偺 cgi-bin 僨傿儗
僋僩儕偵僐僺乕偟偰偔偩偝偄丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

9. Java 偱偺 XML-RPC 偺巊偄曽

Hannes Walln fer 偼 Java 梡 XML-RPC 偺桪傟偨幚憰 <http://helma.at/
hannes/xmlrpc/>傪採嫙偟偰偄傑偡丅

僀儞僗僩乕儖偼丄攝晍暔傪僟僂儞儘乕僪偟偰丄unzip 偟偰丄 CLASSPATH 偵
*.jar 僼傽僀儖傪捛壛偟傑偡丅Unix 僔僗僥儉忋偱丄師偺擖椡偵傛傝偙偺嶌嬈偑
峴偊傑偡丅

bash$ unzip xmlrpc-java.zip
bash$ cd xmlrpc-java/lib
bash$ CLASSPATH=`pwd`/openxml-1.2.jar:`pwd`/xmlrpc.jar:$CLASSPATH

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

9.1. Java 僋儔僀傾儞僩

師偺僾儘僌儔儉僐乕僪傪 JavaClient.java 偲偟偰僼傽僀儖偵曐懚偟偰偔偩偝偄
丅

import java.util.Vector;
import java.util.Hashtable;
import helma.xmlrpc.*;

public class JavaClient {

    // The location of our server.
    private final static String server_url =
        "http://xmlrpc-c.sourceforge.net/api/sample.php";

    public static void main (String [] args) {
        try {

            // Create an object to represent our server.
            XmlRpcClient server = new XmlRpcClient(server_url);

            // Build our parameter list.
            Vector params = new Vector();
            params.addElement(new Integer(5));
            params.addElement(new Integer(3));

            // Call the server, and get our result.
            Hashtable result =
                (Hashtable) server.execute("sample.sumAndDifference", params);
            int sum = ((Integer) result.get("sum")).intValue();
            int difference = ((Integer) result.get("difference")).intValue();

            // Print out our result.
            System.out.println("Sum: " + Integer.toString(sum) +
                               ", Difference: " +
                               Integer.toString(difference));

        } catch (XmlRpcException exception) {
            System.err.println("JavaClient: XML-RPC Fault #" +
                               Integer.toString(exception.code) + ": " +
                               exception.toString());
        } catch (Exception exception) {
            System.err.println("JavaClient: " + exception.toString());
        }
    }
}

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

9.2. 撈棫宆 Java 僒乕僶

師偺僾儘僌儔儉僐乕僪傪 JavaServer.java 偲偟偰僼傽僀儖偵曐懚偟偰偔偩偝偄
丅

import java.util.Hashtable;
import helma.xmlrpc.*;

public class JavaServer {

    public JavaServer () {
        // Our handler is a regular Java object. It can have a
        // constructor and member variables in the ordinary fashion.
        // Public methods will be exposed to XML-RPC clients.
    }

    public Hashtable sumAndDifference (int x, int y) {
        Hashtable result = new Hashtable();
        result.put("sum", new Integer(x + y));
        result.put("difference", new Integer(x - y));
        return result;
    }

    public static void main (String [] args) {
        try {

            // Invoke me as <http://localhost:8080/RPC2>.
            WebServer server = new WebServer(8080);
            server.addHandler("sample", new JavaServer());

        } catch (Exception exception) {
            System.err.println("JavaServer: " + exception.toString());
        }
    }
}

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

10. PHP 偱偺 XML-RPC 偺巊偄曽

Edd Dumbill 偼 PHP 梡 XML-RPC 傪幚憰偟偰偄傑偡丅UsefulInc XML-RPC 僂僃
僽僒僀僩 <http://xmlrpc.usefulinc.com/>偐傜僟僂儞儘乕僪偱偒傑偡丅

攝晍暔傪僀儞僗僩乕儖偡傞偵偼丄偦傟傪夝搥偟偰丄 xmlrpc.inc 偲
xmlrpcs.inc 傪偁側偨偺 PHP 僗僋儕僾僩偑擖偭偰偄傞偺偲摨偠僨傿儗僋僩儕偵
僐僺乕偟傑偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

10.1. PHP 僋儔僀傾儞僩

師偺僗僋儕僾僩偼僂僃僽儁乕僕偺拞偵 XML-RPC 僐乕儖傪慻傒崬傓曽朄傪帵偟傑
偡丅

<html>
<head>
<title>XML-RPC PHP Demo</title>
</head>
<body>
<h1>XML-RPC PHP Demo</h1>

<?php
include 'xmlrpc.inc';

// Make an object to represent our server.
$server = new xmlrpc_client('/api/sample.php',
                            'xmlrpc-c.sourceforge.net', 80);

// Send a message to the server.
$message = new xmlrpcmsg('sample.sumAndDifference',
                         array(new xmlrpcval(5, 'int'),
                               new xmlrpcval(3, 'int')));
$result = $server->send($message);

// Process the response.
if (!$result) {
    print "<p>Could not connect to HTTP server.</p>";
} elseif ($result->faultCode()) {
    print "<p>XML-RPC Fault #" . $result->faultCode() . ": " .
        $result->faultString();
} else {
    $struct = $result->value();
    $sumval = $struct->structmem('sum');
    $sum = $sumval->scalarval();
    $differenceval = $struct->structmem('difference');
    $difference = $differenceval->scalarval();
    print "<p>Sum: " . htmlentities($sum) .
        ", Difference: " . htmlentities($difference) . "</p>";
}
?>

</body></html>

偁側偨偺僂僃僽僒乕僶偑 PHP 僗僋儕僾僩傪幚峴偟側偄応崌丄捛壛忣曬傪摼傞偨
傔偵 PHP 偺僂僃僽僒僀僩 <http://www.php.net/>傪尒偰偔偩偝偄丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

10.2. PHP 僒乕僶

師偺僗僋儕僾僩偼 PHP 傪棙梡偟偨 XML-RPC 僒乕僶偺幚憰偺曽朄傪帵偟傑偡丅

<?php
include 'xmlrpc.inc';
include 'xmlrpcs.inc';

function sumAndDifference ($params) {

    // Parse our parameters.
    $xval = $params->getParam(0);
    $x = $xval->scalarval();
    $yval = $params->getParam(1);
    $y = $yval->scalarval();

    // Build our response.
    $struct = array('sum' => new xmlrpcval($x + $y, 'int'),
                    'difference' => new xmlrpcval($x - $y, 'int'));
    return new xmlrpcresp(new xmlrpcval($struct, 'struct'));
}

// Declare our signature and provide some documentation.
// (The PHP server supports remote introspection. Nifty!)
$sumAndDifference_sig = array(array('struct', 'int', 'int'));
$sumAndDifference_doc = 'Add and subtract two numbers';

new xmlrpc_server(array('sample.sumAndDifference' =>
                        array('function' => 'sumAndDifference',
                              'signature' => $sumAndDifference_sig,
                              'docstring' => $sumAndDifference_doc)));
?>

偁側偨偼捠忢丄 http://localhost/path/sumAndDifference.php 偺傛偆側傕偺
傪屇傃弌偡偱偟傚偆丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

11. Microsoft .NET 偱偺 XML-RPC 偺巊偄曽

Charles Cook 偼偙偺 HOWTO 梡偺桪傟偨怴偟偄復傪幏昅拞偱偡丅憪峞偼僆儞儔
僀儞 <http://www.cookcomputing.com/misc/howto.txt>偱尒傜傟傑偡丅偦偺儁
乕僕偑巔傪徚偟偨傜丄Linux Documentation Project 偱 XML-RPC HOWTO 偺怴斉
<http://www.linuxdoc.org/HOWTO/XML-RPC-HOWTO/index.html> 傪扵偟偰偔偩偝
偄丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

12. Ruby 偱偺 XML-RPC 偺巊偄曽

(XML-RPC HOWTO 偺偙偺復偼 Michael Neumann 偑婥慜傛偔採嫙偟偰偔傟傑偟偨
丅)

Ruby <http://www.ruby-lang.org/> 偼僆僽僕僃僋僩巜岦僗僋儕僾僩尵岅偱偡丅
婛偵擔杮偱偼懡偔偺垽岲幰偑偍傝丄懠強偱傕恖婥偑弌偮偮偁傝傑偡丅

Ruby 偱 XML-RPC 傪巊偆偵偼丄弶傔偵媑揷惓恖偺 xmlparser 儌僕儏乕儖
(James Clark 偺 expat parser 梡儔僢僷乕) 傪僀儞僗僩乕儖偟側偗傟偽側傝傑
偣傫丅偙傟偼 Ruby Application Archive <http://www.ruby-lang.org/en/
raa.html> 偱尒偮偗傜傟傑偡丅

偦偟偰師偺僐儅儞僪傪巊偭偰 xmlrpc4r <http://www.s-direktnet.de/
homepages/neumann/xmlrpc4r/index.html> 傪僀儞僗僩乕儖偟側偗傟偽側傝傑偣
傫丅

bash$ tar -xvzf xmlrpc4r-1_2.tar.gz
bash$ cd xmlrpc4r-1_2
bash$ su root -c "ruby install.rb"

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

12.1. Ruby 僋儔僀傾儞僩

扨弮側 Ruby 僋儔僀傾儞僩傪帵偟傑偡 -

require "xmlrpc/client"

# Make an object to represent the XML-RPC server.
server = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php")

# Call the remote server and get our result
result = server.call("sample.sumAndDifference", 5, 3)

sum = result["sum"]
difference = result["difference"]

puts "Sum: #{sum}, Difference: #{difference}"

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

12.2. Ruby 僒乕僶

扨弮側 Ruby 僒乕僶傪帵偟傑偡 -

require "xmlrpc/server"

s = XMLRPC::CGIServer.new

s.add_hanlder("sample.sumAndDifference") do |a,b|
  { "sum" => a + b, "difference" => a - b }
end

s.serve

傑偨丄師偺傛偆偵彂偔偙偲傕偱偒傑偡丅

require "xmlrpc/server"

s = XMLRPC::CGIServer.new

class MyHandler
  def sumAndDifference(a, b)
    { "sum" => a + b, "difference" => a - b }
  end
end

s.add_handler("sample", MyHandler.new)
s.serve

偳偪傜偺僒乕僶傕撈棫宆偱幚峴偡傞偵偼丄僾儘僌儔儉偺擇峴栚傪

s = XMLRPC::Server.new(8080)

偵彂偒偐偊偰偔偩偝偄丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

13. 撈帺揑側尵岅偱偺 XML-RPC 偺巊偄曽

XML-RPC 偺幚憰偼埲壓偵帵偡撈帺揑側僾儘僌儔儈儞僌尵岅偍傛傃娐嫬偱棙梡偱
偒傑偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

13.1. K 偱偺 XML-RPC 偺巊偄曽

(XML-RPC HOWTO 偺偙偺復偼 Christian Langreiter 偑婥慜傛偔採嫙偟偰偔傟傑
偟偨丅)

K <http://www.kx.com/> 偼夛寁張棟偍傛傃僨乕僞儀乕僗奐敪偱巊傢傟傞尵岅偱
偡丅K 梡 XML-RPC 傪僀儞僗僩乕儖偡傞偵偼 Kx 偺僂僃僽僒僀僩 <http://
www.langreiter.com/k/kxr>偐傜僟僂儞儘乕僪偟傑偡丅夝搥偟偰偁側偨偺 .k 僾
儘僌儔儉傪曐帩偟偰偄傞僨傿儗僋僩儕偵僼傽僀儖傪僐僺乕偟傑偡丅

抁偄僋儔僀傾儞僩傪帵偟傑偡 -

\l kxr
server:("localhost";"/cgi-bin/sumAndDifference.cgi");
.kxr.c[server;"sumAndDifference";2 3]

偦偟偰僒乕僶傪帵偟傑偡 -

\l kxrsc
.kxr.sm: ,("sumAndDifference";{.((`sum;+/x);(`difference;-/x))})

偝傜偵懡偔偺椺偑攝晍暔偺拞偵偁傝傑偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

14. XML-RPC 僒億乕僩偑慻傒崬傑傟偨傾僾儕働乕僔儑儞

偄偔偮偐偺堦斒揑側 Linux 傾僾儕働乕僔儑儞偼 XML-RPC 偺僒億乕僩傪偟偰偄
傑偡丅偙傟傜偼婛偵懠偺偲偙傠偱愢柧偑偝傟偰偄傞偺偱丄偙偙偱偼庡偵偦偺婰
帠傊偺億僀儞僞傪帵偟傑偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

14.1. Zope

Zope 偱偺 XML-RPC 偺巊梡偵娭偡傞婰帠偼師偵帵偡僂僃僽偐傜擖庤偱偒傑偡丅

 丒 Jon Udell 偵傛傞 Zope 偱偺 XML-RPC 僾儘僌儔儈儞僌 <http://
    www.byte.com/column/BYT19991021S0014>

 丒 UserLand.Com 偺 Zope XML-RPC <http://linux.userland.com/stories/
    storyReader$18>

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

14.2. KDE 2.0

KDE 2.0 偼 Kurt Ganroth 偺 kxmlrpc 僨乕儌儞 <http://
kdecvs.stud.fh-heilbronn.de/cvsweb/kdebase/kxmlrpc/>傪娷傒丄僨乕儌儞偼
XML-RPC 傪巊偭偨 KDE 傾僾儕働乕僔儑儞偺偨傔偺偍慥棫偰傪偟傑偡丅

Python 偱彂偐傟偨抁偄傾僾儕働乕僔儑儞偺椺 <http://
kdecvs.stud.fh-heilbronn.de/cvsweb/kdebase/kxmlrpc/test/testxmlrpc.py?
rev=1.6&content-type=text/x-cvsweb-markup>偑偁傝傑偡丅偦傟偼 kxmlrpc 傊
愙懕偡傞丄 KDE 偺廧強榐傪憖嶌偡傞丄KDE 僩儗乕僟傪専嶕偡傞偲偄偭偨曽朄傪
帵偟傑偡丅

偁側偨偑偦偺懠偵婰帠傗僾儘僌儔儉偺椺傪帩偭偰偄傞応崌丄 Section 15.3> 傪
尒偰偔偩偝偄丅巹払偼 KDE 傪婰弎偡傞忋偱傕偭偲懡偔偺忣曬傪帩偪偨偄偲巚偭
偰偄傑偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

15. 偙偺暥彂偵偮偄偰

偙偺暥彂偼 Linux Documentation Project <http://www.linuxdoc.org/> 偵強
憼偝傟偰偄傑偡丅Dave Winer 偍傛傃條乆側 XML-RPC 儔僀僽儔儕偺偡傋偰偺娗
棟幰偵姶幱偟傑偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

15.1. 偙偺暥彂偺怴斉

偙偺暥彂偺怴斉偼 Linux Documentation Project <http://www.linuxdoc.org/
HOWTO/XML-RPC-HOWTO/index.html> 偺僂僃僽僒僀僩偱擖庤偱偒傑偡丅

傑偨師偺僼僅乕儅僢僩偱傕採嫙偝傟偰偄傑偡丅 PDF <http://www.ibiblio.org/
pub/Linux/docs/HOWTO/other-formats/pdf/XML-RPC-HOWTO.pdf>, gzipped HTML
<http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html/
XML-RPC-HOWTO-html.tar.gz> 偍傛傃 ASCII text <http://www.ibiblio.org/
pub/Linux/docs/HOWTO/XML-RPC-HOWTO>丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

15.2. XML-RPC HOWTO 偺婑峞幰

Ruby 偵娭偡傞復偼 Michael Neumann (neumann AT s-direktnet DOT de) 偵傛
傝婑峞偝傟傑偟偨丅K 偵娭偡傞復偼 Christian Langreiter (c DOT langreiter
AT synerge DOT at) 偵傛傝婑峞偝傟傑偟偨丅

[栿拲丗忋婰偺柤慜偺屻偺 () 撪偼儊乕儖傾僪儗僗傪帵偟偰偄傑偡丅乽AT乿偼乽
@乿丄乽DOT乿偼乽.乿偵抲偒偐偊偰丄嬻敀傪彍嫀偡傟偽儊乕儖傾僪儗僗偑摼傜傟
傑偡丅]

婑峞幰偼偦偺復偺巒傔偵婰擖偝傟偰偄傑偡丅

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

15.3. 懠偺忣曬偺採弌

暿偺尵岅傗娐嫬偱偺僋儔僀傾儞僩傗僒乕僶偺椺傪帩偭偰偄傞応崌丄偙偺暥彂偵
捛壛偟偨偄偲偲偰傕巚偭偰傑偡丅怴偟偄僄儞僩儕傪捛壛偡傞偨傔偵丄師偵帵偡
忣曬偑昁梫偱偡丅

 丒 XML-RPC 傪巊梡偟偨幚憰偺 URL

 丒 僀儞僗僩乕儖庤弴

 丒 姰慡側幚峴偱偒傞僾儘僌儔儉

 丒 昁梫側傜僐儞僷僀儖庤弴

暥彂偵婰嵹偟偰傕偐傑傢側偄 E-mail 傾僪儗僗 - 椺偊偽 xmlrpc-c-devel 儊乕
儕儞僌儕僗僩 <http://xmlrpc-c.sourceforge.net/lists.php> 傕偟偔偼丄捈愙
偺 Eric Kidd <mailto:eric.kidd@pobox.com>丅

忣曬傪偍懸偪偟偰偄傑偡両

劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒

16. 擔杮岅栿偵偮偄偰

擔杮岅栿偼 Linux Japanese FAQ Project 偑峴偄傑偟偨丅東栿偵娭偡傞偛堄尒
偼 JF 僾儘僕僃僋僩 <JF@linux.or.jp> 埗偵楢棈偟偰偔偩偝偄丅

0.8.0j

東栿:

    栰杮峗堦 <hng@ps.ksky.ne.jp>

峑惓:

     仩 愮扷桾巌偝傫 <ysenda@pop01.odn.ne.jp>

     仩 嶳揷怲栫偝傫 <trueheart@anet.ne.jp>

