X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=demo%2Fclient%2Fintrospect.php;h=55dec8a78769eb91195398c50e4c0bffcdd11cad;hb=4c4c28971620235b1a225c106dfad85a87731a25;hp=818e04c62f2a5567d86c074261977742457b6c01;hpb=aafee68e34ad3b334b55dc5f22f90db985b53c6a;p=plcapi.git diff --git a/demo/client/introspect.php b/demo/client/introspect.php index 818e04c..55dec8a 100644 --- a/demo/client/introspect.php +++ b/demo/client/introspect.php @@ -1,108 +1 @@ - -xmlrpc - -

Introspect demo

-

Query server for available methods and their description

-

The code demonstrates usage of multicall and introspection methods

-faultCode() - . " Reason: '" .$r->faultString()."'
"; - } - - // 'new style' client constuctor - $c = new xmlrpc_client("http://phpxmlrpc.sourceforge.net/server.php"); - print "

methods available at http://" . $c->server . $c->path . "

\n"; - - $m = new xmlrpcmsg('system.listMethods'); - $r =& $c->send($m); - if($r->faultCode()) - { - display_error($r); - } - else - { - $v=$r->value(); - for($i=0; $i<$v->arraysize(); $i++) - { - $mname=$v->arraymem($i); - print "

" . $mname->scalarval() . "

\n"; - - // build messages first, add params later - $m1 = new xmlrpcmsg('system.methodHelp'); - $m2 = new xmlrpcmsg('system.methodSignature'); - $val = new xmlrpcval($mname->scalarval(), "string"); - $m1->addParam($val); - $m2->addParam($val); - - // send multiple messages in one pass. - // If server does not support multicall, client will fall back to 2 separate calls - $ms = array($m1, $m2); - $rs =& $c->send($ms); - - if($rs[0]->faultCode()) - { - display_error($rs[0]); - } - else - { - $val=$rs[0]->value(); - $txt=$val->scalarval(); - if($txt != "") - { - print "

Documentation

${txt}

\n"; - } - else - { - print "

No documentation available.

\n"; - } - } - - if($rs[1]->faultCode()) - { - display_error($rs[1]); - } - else - { - print "

Signature

\n"; - $val = $rs[1]->value(); - if($val->kindOf()=="array") - { - for($j=0; $j<$val->arraysize(); $j++) - { - $x = $val->arraymem($j); - $ret = $x->arraymem(0); - print "" . $ret->scalarval() . " " - . $mname->scalarval() . "("; - if($x->arraysize()>1) - { - for($k=1; $k<$x->arraysize(); $k++) - { - $y = $x->arraymem($k); - print $y->scalarval(); - if($k < $x->arraysize()-1) - { - print ", "; - } - } - } - print ")
\n"; - } - } - else - { - print "Signature unknown\n"; - } - print "

\n"; - } - } - } -?> -
-$Id$ - - + xmlrpc

Introspect demo

Query server for available methods and their description

The code demonstrates usage of multicall and introspection methods

faultCode() . " Reason: '" .$r->faultString()."'
"; } // 'new style' client constuctor $c = new xmlrpc_client("http://phpxmlrpc.sourceforge.net/server.php"); print "

methods available at http://" . $c->server . $c->path . "

\n"; $m = new xmlrpcmsg('system.listMethods'); $r =& $c->send($m); if($r->faultCode()) { display_error($r); } else { $v=$r->value(); for($i=0; $i<$v->arraysize(); $i++) { $mname=$v->arraymem($i); print "

" . $mname->scalarval() . "

\n"; // build messages first, add params later $m1 = new xmlrpcmsg('system.methodHelp'); $m2 = new xmlrpcmsg('system.methodSignature'); $val = new xmlrpcval($mname->scalarval(), "string"); $m1->addParam($val); $m2->addParam($val); // send multiple messages in one pass. // If server does not support multicall, client will fall back to 2 separate calls $ms = array($m1, $m2); $rs =& $c->send($ms); if($rs[0]->faultCode()) { display_error($rs[0]); } else { $val=$rs[0]->value(); $txt=$val->scalarval(); if($txt != "") { print "

Documentation

${txt}

\n"; } else { print "

No documentation available.

\n"; } } if($rs[1]->faultCode()) { display_error($rs[1]); } else { print "

Signature

\n"; $val = $rs[1]->value(); if($val->kindOf()=="array") { for($j=0; $j<$val->arraysize(); $j++) { $x = $val->arraymem($j); $ret = $x->arraymem(0); print "" . $ret->scalarval() . " " . $mname->scalarval() . "("; if($x->arraysize()>1) { for($k=1; $k<$x->arraysize(); $k++) { $y = $x->arraymem($k); print $y->scalarval(); if($k < $x->arraysize()-1) { print ", "; } } } print ")
\n"; } } else { print "Signature unknown\n"; } print "

\n"; } } } ?> \ No newline at end of file