Files
archived-presentations/slides/sdphp/ws_xmlrpc-example.xml

36 lines
1.1 KiB
XML

<slide title='method.sql'>
<example title='Using method.sql from the XML-RPC service' result='0'
fontsize='1.2em' rfontsize='1em' outputbackground='#ffffdd'>
<![CDATA[<?php
require_once "XML/RPC.php";
require_once "slides/mdb/scripts/xmlrpc_util.php";
require_once "slides/mdb/scripts/mdb_tests.cfg";
?>
<b>method.sql:</b>
<small>"select source_id,expdata,rev_date,resolution,description
from protein limit 10"</small><br>
<?php
$method = "method.sql";
$query = "select source_id,expdata,resolution,description ";
$query .= "from protein where expdata like '%x-ray%' and ";
$query .= "resolution >= 0.7 order by resolution limit 5";
$q = new XML_RPC_Value($query, $GLOBALS['XML_RPC_String']);
$msg = new XML_RPC_Message($method,array($q));
$c=new XML_RPC_Client(XMLRPC_URI, MDB_SERVER_NAME, MDB_SERVER_PORT);
$r = $c->send($msg);
if (!$r->faultCode()) {
echo toTable(XML_RPC_decode($r->value()));
} else {
echo "<pre>\n";
echo "ERROR: ".$r->faultCode()." -- ".$r->faultString();
echo "</pre>\n";
}
?>
]]>
</example>
<example title='Output' type='html' filename='output/xmlrpc_method_sql_out.html'
fontsize='1.5em' examplebackground='#ffffdd'/>
</slide>