git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_SGD/tags/3.7.0.2_original@1 eb19766c-00d9-a042-a3a0-45cb8ec72764
6 lines
9.7 KiB
HTML
6 lines
9.7 KiB
HTML
<html><head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>2. xmlrpcmsg</title><link rel="stylesheet" href="html.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.71.1"><link rel="start" href="index.html" title="XML-RPC for PHP"><link rel="up" href="ch07.html" title="Chapter 7. Class documentation"><link rel="prev" href="ch07s01.html" title="1. xmlrpcval"><link rel="next" href="ch07s03.html" title="3. xmlrpc_client"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2. xmlrpcmsg</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07s01.html">Prev</a> </td><th width="60%" align="center">Chapter 7. Class documentation</th><td width="20%" align="right"> <a accesskey="n" href="ch07s03.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="xmlrpcmsg"></a>2. xmlrpcmsg</h2></div></div></div><p>This class provides a representation for a request to an XML-RPC server. A client sends an <code class="classname">xmlrpcmsg</code> to a server, and receives back an <code class="classname">xmlrpcresp</code> (see <a href="ch07s03.html#xmlrpc-client-send">xmlrpc_client->send</a>).</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1373"></a>2.1. Creation</h3></div></div></div><p>The constructor takes the following forms:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$msg = new <b class="fsfunc">xmlrpcmsg</b>(</code></td><td><var class="pdparam">$methodName</var>, </td><td> </td></tr><tr><td> </td><td><var class="pdparam">$parameterArray</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string</code> </td><td><code><var class="pdparam">$methodName</var>;</code></td></tr><tr><td><code>array</code> </td><td><code><var class="pdparam">$parameterArray</var>null;</code></td></tr></table></div><p>Where <em class="parameter"><code>methodName</code></em> is a string indicating the name of the method you wish to invoke, and <em class="parameter"><code>parameterArray</code></em> is a simple php <code class="classname">Array</code> of <code class="classname">xmlrpcval</code> objects. Here's an example message to the <span class="emphasis"><em>US state name</em></span> server:</p><pre class="programlisting">
|
|
$msg = new xmlrpcmsg("examples.getStateName", array(new xmlrpcval(23, "int")));
|
|
|
|
</pre><p>This example requests the name of state number 23. For more information on <code class="classname">xmlrpcval</code> objects, see <a href="ch07s01.html">xmlrpcval</a>.</p><p>Note that the <em class="parameter"><code>parameterArray</code></em> parameter is optional and can be omitted for methods that take no input parameters or if you plan to add parameters one by one.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e1427"></a>2.2. Methods</h3></div></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1430"></a>2.2.1. addParam</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$ok = $msg-><b class="fsfunc">addParam</b>(</code></td><td><var class="pdparam">$xmlrpcVal</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>xmlrpcval</code> </td><td><code><var class="pdparam">$xmlrpcVal</var>;</code></td></tr></table></div><p>Adds the <code class="classname">xmlrpcval</code> <em class="parameter"><code>xmlrpcVal</code></em> to the parameter list for this method call. Returns TRUE or FALSE on error.</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1452"></a>2.2.2. getNumParams</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$n = $msg-><b class="fsfunc">getNumParams</b>(</code></td><td><code>)</code>;</td><td> </td></tr></table></div><p>Returns the number of parameters attached to this message.</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1464"></a>2.2.3. getParam</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$xmlrpcVal = $msg-><b class="fsfunc">getParam</b>(</code></td><td><var class="pdparam">$n</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>int</code> </td><td><code><var class="pdparam">$n</var>;</code></td></tr></table></div><p>Gets the <em class="parameter"><code>n</code></em>th parameter in the message (with the index zero-based). Use this method in server implementations to retrieve the values sent by the client.</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1483"></a>2.2.4. method</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$methName = $msg-><b class="fsfunc">method</b>(</code></td><td><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$msg->method(</code></td><td><var class="pdparam">$methName</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string</code> </td><td><code><var class="pdparam">$methName</var>;</code></td></tr></table></div><p>Gets or sets the method contained in the XML-RPC message.</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1503"></a>2.2.5. parseResponse</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$response = $msg-><b class="fsfunc">parseResponse</b>(</code></td><td><var class="pdparam">$xmlString</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string</code> </td><td><code><var class="pdparam">$xmlString</var>;</code></td></tr></table></div><p>Given an incoming XML-RPC server response contained in the string <em class="parameter"><code>$xmlString</code></em>, this method constructs an <code class="classname">xmlrpcresp</code> response object and returns it, setting error codes as appropriate (see <a href="ch07s03.html#xmlrpc-client-send">xmlrpc_client->send</a>).</p><p>This method processes any HTTP/MIME headers it finds.</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1529"></a>2.2.6. parseResponseFile</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$response = $msg-><b class="fsfunc">parseResponseFile</b>(</code></td><td><var class="pdparam">$fileHandle</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>file handle resource</code> </td><td><code><var class="pdparam">$fileHandle</var>;</code></td></tr></table></div><p>Given an incoming XML-RPC server response on the open file handle <em class="parameter"><code>fileHandle</code></em>, this method reads all the data it finds and passes it to <code class="function">parseResponse.</code></p><p>This method is useful to construct responses from pre-prepared files (see files <code class="literal">demo1.txt, demo2.txt, demo3.txt</code> in this distribution). It processes any HTTP headers it finds, and does not close the file handle.</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="d0e1555"></a>2.2.7. serialize</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$outString = $msg-><b class="fsfunc">serialize</b>(</code></td><td><code>)</code>;</td><td> </td></tr></table></div><p>Returns the an XML string representing the XML-RPC message.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch07s01.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch07.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch07s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">1. xmlrpcval </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 3. xmlrpc_client</td></tr></table></div></body></html> |