|
|
@@ -13,7 +13,6 @@
|
|
|
between <acronym>PHP</acronym> and <acronym>XML-RPC</acronym>, a server proxy object,
|
|
|
and access to server introspection capabilities.
|
|
|
</para>
|
|
|
-
|
|
|
</sect2>
|
|
|
|
|
|
<sect2 id="zend.xmlrpc.client.method-calls">
|
|
|
@@ -36,6 +35,7 @@
|
|
|
|
|
|
<example id="zend.xmlrpc.client.method-calls.example-1">
|
|
|
<title>XML-RPC Method Call</title>
|
|
|
+
|
|
|
<programlisting language="php"><![CDATA[
|
|
|
$client = new Zend_XmlRpc_Client('http://framework.zend.com/xmlrpc');
|
|
|
|
|
|
@@ -62,6 +62,7 @@ echo $client->call('test.sayHello');
|
|
|
|
|
|
<example id="zend.xmlrpc.client.method-calls.example-2">
|
|
|
<title>XML-RPC Method Call with Parameters</title>
|
|
|
+
|
|
|
<programlisting language="php"><![CDATA[
|
|
|
$client = new Zend_XmlRpc_Client('http://framework.zend.com/xmlrpc');
|
|
|
|
|
|
@@ -93,6 +94,7 @@ $result = $client->call('test.sayHello', array($arg1, $arg2));
|
|
|
|
|
|
<sect2 id="zend.xmlrpc.value.parameters">
|
|
|
<title>Types and Conversions</title>
|
|
|
+
|
|
|
<para>
|
|
|
Some remote method calls require parameters. These are given to
|
|
|
the <methodname>call()</methodname> method of <classname>Zend_XmlRpc_Client</classname>
|
|
|
@@ -104,6 +106,7 @@ $result = $client->call('test.sayHello', array($arg1, $arg2));
|
|
|
|
|
|
<sect3 id="zend.xmlrpc.value.parameters.php-native">
|
|
|
<title>PHP Native Types as Parameters</title>
|
|
|
+
|
|
|
<para>
|
|
|
Parameters may be passed to <methodname>call()</methodname> as native
|
|
|
<acronym>PHP</acronym> variables, meaning as a <type>String</type>,
|
|
|
@@ -116,6 +119,7 @@ $result = $client->call('test.sayHello', array($arg1, $arg2));
|
|
|
|
|
|
<table id="zend.xmlrpc.value.parameters.php-native.table-1">
|
|
|
<title>PHP and XML-RPC Type Conversions</title>
|
|
|
+
|
|
|
<tgroup cols="2">
|
|
|
<thead>
|
|
|
<row>
|
|
|
@@ -123,47 +127,58 @@ $result = $client->call('test.sayHello', array($arg1, $arg2));
|
|
|
<entry><acronym>XML-RPC</acronym> Type</entry>
|
|
|
</row>
|
|
|
</thead>
|
|
|
+
|
|
|
<tbody>
|
|
|
<row>
|
|
|
<entry>integer</entry>
|
|
|
<entry>int</entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>Zend_Crypt_Math_BigInteger</entry>
|
|
|
<entry>i8</entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>double</entry>
|
|
|
<entry>double</entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>boolean</entry>
|
|
|
<entry>boolean</entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>string</entry>
|
|
|
<entry>string</entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>null</entry>
|
|
|
<entry>nil</entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>array</entry>
|
|
|
<entry>array</entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>associative array</entry>
|
|
|
<entry>struct</entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>object</entry>
|
|
|
<entry>array</entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>Zend_Date</entry>
|
|
|
<entry>dateTime.iso8601</entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>DateTime</entry>
|
|
|
<entry>dateTime.iso8601</entry>
|
|
|
@@ -209,6 +224,7 @@ $result = $client->call('foo.bar', array(array()));
|
|
|
|
|
|
<sect3 id="zend.xmlrpc.value.parameters.xmlrpc-value">
|
|
|
<title>Zend_XmlRpc_Value Objects as Parameters</title>
|
|
|
+
|
|
|
<para>
|
|
|
Parameters may also be created as <classname>Zend_XmlRpc_Value</classname>
|
|
|
instances to specify an exact <acronym>XML-RPC</acronym> type. The primary reasons
|
|
|
@@ -223,6 +239,7 @@ $result = $client->call('foo.bar', array(array()));
|
|
|
from a database as a string)
|
|
|
</para>
|
|
|
</listitem>
|
|
|
+
|
|
|
<listitem>
|
|
|
<para>
|
|
|
When the procedure requires <property>base64</property> or
|
|
|
@@ -230,6 +247,7 @@ $result = $client->call('foo.bar', array(array()));
|
|
|
<acronym>PHP</acronym> native type)
|
|
|
</para>
|
|
|
</listitem>
|
|
|
+
|
|
|
<listitem>
|
|
|
<para>
|
|
|
When auto-conversion may fail (i.e. you want to
|
|
|
@@ -252,6 +270,7 @@ $result = $client->call('foo.bar', array(array()));
|
|
|
|
|
|
<table id="zend.xmlrpc.value.parameters.xmlrpc-value.table-1">
|
|
|
<title>Zend_XmlRpc_Value Objects for XML-RPC Types</title>
|
|
|
+
|
|
|
<tgroup cols="3">
|
|
|
<thead>
|
|
|
<row>
|
|
|
@@ -260,89 +279,125 @@ $result = $client->call('foo.bar', array(array()));
|
|
|
<entry><classname>Zend_XmlRpc_Value</classname> Object</entry>
|
|
|
</row>
|
|
|
</thead>
|
|
|
+
|
|
|
<tbody>
|
|
|
<row>
|
|
|
<entry>int</entry>
|
|
|
+
|
|
|
<entry>
|
|
|
<constant>Zend_XmlRpc_Value::XMLRPC_TYPE_INTEGER</constant>
|
|
|
</entry>
|
|
|
+
|
|
|
<entry><classname>Zend_XmlRpc_Value_Integer</classname></entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>i8</entry>
|
|
|
+
|
|
|
<entry>
|
|
|
<constant>Zend_XmlRpc_Value::XMLRPC_TYPE_I8</constant>
|
|
|
</entry>
|
|
|
+
|
|
|
<entry><classname>Zend_XmlRpc_Value_BigInteger</classname></entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>ex:i8</entry>
|
|
|
+
|
|
|
<entry>
|
|
|
<constant>Zend_XmlRpc_Value::XMLRPC_TYPE_APACHEI8</constant>
|
|
|
</entry>
|
|
|
+
|
|
|
<entry><classname>Zend_XmlRpc_Value_BigInteger</classname></entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>double</entry>
|
|
|
+
|
|
|
<entry>
|
|
|
<constant>Zend_XmlRpc_Value::XMLRPC_TYPE_DOUBLE</constant>
|
|
|
</entry>
|
|
|
+
|
|
|
<entry><classname>Zend_XmlRpc_Value_Double</classname></entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>boolean</entry>
|
|
|
+
|
|
|
<entry>
|
|
|
<constant>Zend_XmlRpc_Value::XMLRPC_TYPE_BOOLEAN</constant>
|
|
|
</entry>
|
|
|
+
|
|
|
<entry><classname>Zend_XmlRpc_Value_Boolean</classname></entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>string</entry>
|
|
|
+
|
|
|
<entry>
|
|
|
<constant>Zend_XmlRpc_Value::XMLRPC_TYPE_STRING</constant>
|
|
|
</entry>
|
|
|
+
|
|
|
<entry><classname>Zend_XmlRpc_Value_String</classname></entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>nil</entry>
|
|
|
+
|
|
|
<entry>
|
|
|
<constant>Zend_XmlRpc_Value::XMLRPC_TYPE_NIL</constant>
|
|
|
</entry>
|
|
|
+
|
|
|
<entry><classname>Zend_XmlRpc_Value_Nil</classname></entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>ex:nil</entry>
|
|
|
+
|
|
|
<entry>
|
|
|
<constant>Zend_XmlRpc_Value::XMLRPC_TYPE_APACHENIL</constant>
|
|
|
</entry>
|
|
|
+
|
|
|
<entry><classname>Zend_XmlRpc_Value_Nil</classname></entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>base64</entry>
|
|
|
+
|
|
|
<entry>
|
|
|
<constant>Zend_XmlRpc_Value::XMLRPC_TYPE_BASE64</constant>
|
|
|
</entry>
|
|
|
+
|
|
|
<entry><classname>Zend_XmlRpc_Value_Base64</classname></entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>dateTime.iso8601</entry>
|
|
|
+
|
|
|
<entry>
|
|
|
<constant>Zend_XmlRpc_Value::XMLRPC_TYPE_DATETIME</constant>
|
|
|
</entry>
|
|
|
+
|
|
|
<entry><classname>Zend_XmlRpc_Value_DateTime</classname></entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>array</entry>
|
|
|
+
|
|
|
<entry>
|
|
|
<constant>Zend_XmlRpc_Value::XMLRPC_TYPE_ARRAY</constant>
|
|
|
</entry>
|
|
|
+
|
|
|
<entry><classname>Zend_XmlRpc_Value_Array</classname></entry>
|
|
|
</row>
|
|
|
+
|
|
|
<row>
|
|
|
<entry>struct</entry>
|
|
|
+
|
|
|
<entry>
|
|
|
<constant>Zend_XmlRpc_Value::XMLRPC_TYPE_STRUCT</constant>
|
|
|
</entry>
|
|
|
+
|
|
|
<entry><classname>Zend_XmlRpc_Value_Struct</classname></entry>
|
|
|
</row>
|
|
|
</tbody>
|
|
|
@@ -352,6 +407,7 @@ $result = $client->call('foo.bar', array(array()));
|
|
|
<para>
|
|
|
<note>
|
|
|
<title>Automatic Conversion</title>
|
|
|
+
|
|
|
<para>
|
|
|
When building a new <classname>Zend_XmlRpc_Value</classname>
|
|
|
object, its value is set by a <acronym>PHP</acronym> type. The
|
|
|
@@ -368,6 +424,7 @@ $result = $client->call('foo.bar', array(array()));
|
|
|
|
|
|
<sect2 id="zend.xmlrpc.client.requests-and-responses">
|
|
|
<title>Server Proxy Object</title>
|
|
|
+
|
|
|
<para>
|
|
|
Another way to call remote methods with the <acronym>XML-RPC</acronym> client is to
|
|
|
use the server proxy. This is a <acronym>PHP</acronym> object that proxies a remote
|
|
|
@@ -386,6 +443,7 @@ $result = $client->call('foo.bar', array(array()));
|
|
|
|
|
|
<example id="zend.xmlrpc.client.requests-and-responses.example-1">
|
|
|
<title>Proxy the Default Namespace</title>
|
|
|
+
|
|
|
<programlisting language="php"><![CDATA[
|
|
|
$client = new Zend_XmlRpc_Client('http://framework.zend.com/xmlrpc');
|
|
|
|
|
|
@@ -405,6 +463,7 @@ $hello = $service->test->sayHello(1, 2); // test.Hello(1, 2) returns "hello"
|
|
|
|
|
|
<example id="zend.xmlrpc.client.requests-and-responses.example-2">
|
|
|
<title>Proxy Any Namespace</title>
|
|
|
+
|
|
|
<programlisting language="php"><![CDATA[
|
|
|
$client = new Zend_XmlRpc_Client('http://framework.zend.com/xmlrpc');
|
|
|
|
|
|
@@ -425,6 +484,7 @@ $hello = $test->sayHello(1, 2); // test.Hello(1,2) returns "hello"
|
|
|
|
|
|
<sect2 id="zend.xmlrpc.client.error-handling">
|
|
|
<title>Error Handling</title>
|
|
|
+
|
|
|
<para>
|
|
|
Two kinds of errors can occur during an <acronym>XML-RPC</acronym> method call:
|
|
|
<acronym>HTTP</acronym> errors and <acronym>XML-RPC</acronym> faults. The
|
|
|
@@ -523,11 +583,11 @@ try {
|
|
|
<classname>Zend_XmlRpc_Response</classname>.
|
|
|
</para>
|
|
|
</sect3>
|
|
|
-
|
|
|
</sect2>
|
|
|
|
|
|
<sect2 id="zend.xmlrpc.client.introspection">
|
|
|
<title>Server Introspection</title>
|
|
|
+
|
|
|
<para>
|
|
|
Some <acronym>XML-RPC</acronym> servers support the de facto introspection methods
|
|
|
under the <acronym>XML-RPC</acronym> <emphasis>system.</emphasis> namespace.
|
|
|
@@ -545,6 +605,7 @@ try {
|
|
|
|
|
|
<sect2 id="zend.xmlrpc.client.request-to-response">
|
|
|
<title>From Request to Response</title>
|
|
|
+
|
|
|
<para>
|
|
|
Under the hood, the <methodname>call()</methodname> instance method of
|
|
|
<classname>Zend_XmlRpc_Client</classname> builds a request object
|
|
|
@@ -609,7 +670,6 @@ $client->doRequest($request);
|
|
|
<classname>Zend_XmlRpc_Client</classname> for examples of how to do this.
|
|
|
</para>
|
|
|
</sect2>
|
|
|
-
|
|
|
</sect1>
|
|
|
<!--
|
|
|
vim:se ts=4 sw=4 et:
|