215 lines
2.8 KiB
HTML
215 lines
2.8 KiB
HTML
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>A Sample API: sumAndDifference</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.63
|
|
"><LINK
|
|
REL="HOME"
|
|
TITLE="XML-RPC HOWTO"
|
|
HREF="index.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Common XML-RPC Interfaces"
|
|
HREF="xmlrpc-howto-interfaces.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="Using XML-RPC with Perl"
|
|
HREF="xmlrpc-howto-perl.html"></HEAD
|
|
><BODY
|
|
CLASS="section"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>XML-RPC HOWTO</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="xmlrpc-howto-interfaces.html"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
></TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="xmlrpc-howto-perl.html"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="section"
|
|
><H1
|
|
CLASS="section"
|
|
><A
|
|
NAME="xmlrpc-howto-api"
|
|
>5. A Sample API: <TT
|
|
CLASS="function"
|
|
>sumAndDifference</TT
|
|
></A
|
|
></H1
|
|
><P
|
|
>To demonstrate XML-RPC, we implement the following API in as many
|
|
languages as possible.</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="synopsis"
|
|
><SPAN
|
|
CLASS="returnvalue"
|
|
>struct</SPAN
|
|
> <TT
|
|
CLASS="function"
|
|
>sample.sumAndDifference</TT
|
|
> (<SPAN
|
|
CLASS="type"
|
|
>int</SPAN
|
|
> <TT
|
|
CLASS="parameter"
|
|
><I
|
|
>x</I
|
|
></TT
|
|
>, <SPAN
|
|
CLASS="type"
|
|
>int</SPAN
|
|
> <TT
|
|
CLASS="parameter"
|
|
><I
|
|
>y</I
|
|
></TT
|
|
>)</PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>This function takes two integers as arguments, and returns an
|
|
XML-RPC <TT
|
|
CLASS="literal"
|
|
><struct></TT
|
|
> containing two elements:</P
|
|
><P
|
|
></P
|
|
><DIV
|
|
CLASS="variablelist"
|
|
><DL
|
|
><DT
|
|
><TT
|
|
CLASS="parameter"
|
|
><I
|
|
>sum</I
|
|
></TT
|
|
></DT
|
|
><DD
|
|
><P
|
|
>The sum of the two integers.</P
|
|
></DD
|
|
><DT
|
|
><TT
|
|
CLASS="parameter"
|
|
><I
|
|
>difference</I
|
|
></TT
|
|
></DT
|
|
><DD
|
|
><P
|
|
>The difference between the two integers.</P
|
|
></DD
|
|
></DL
|
|
></DIV
|
|
><P
|
|
>It's not very useful, but it makes a nice example. :-)</P
|
|
><P
|
|
>This function (and others) are available using the URL
|
|
<TT
|
|
CLASS="literal"
|
|
>http://xmlrpc-c.sourceforge.net/api/sample.php</TT
|
|
>.
|
|
(This URL won't do anything in a browser; it requires an XML-RPC
|
|
client.)</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="xmlrpc-howto-interfaces.html"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="xmlrpc-howto-perl.html"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Common XML-RPC Interfaces</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
> </TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>Using XML-RPC with Perl</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |