Signature " . ($i + 1) . " | ";
- $x = $r2->arraymem($i);
if ($x->kindOf() == "array") {
- $ret = $x->arraymem(0);
+ $ret = $x[0];
echo "OUT: " . htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . " IN: (";
- if ($x->arraysize() > 1) {
- for ($k = 1; $k < $x->arraysize(); $k++) {
- $y = $x->arraymem($k);
+ if ($x->count() > 1) {
+ foreach($x as $k => $y) {
+ if ($k == 0) continue;
echo htmlspecialchars($y->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding);
if ($wstype != 1) {
$type = $y->scalarval();
- if ($type == 'null') {
- $type = 'nil';
+ $payload .= '';
+ switch($type) {
+ case 'undefined':
+ break;
+ case 'null';
+ $type = 'nil';
+ // fall thru intentionally
+ default:
+ $payload .= '<' .
+ htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) .
+ '>' . htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) .
+ '>';
}
- $payload = $payload . '<' .
- htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) .
- '>' . htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) .
- ">\n";
+ $payload .= "\n";
}
$alt_payload .= $y->scalarval();
- if ($k < $x->arraysize() - 1) {
+ if ($k < $x->count() - 1) {
$alt_payload .= ';';
echo ", ";
}
@@ -463,7 +468,7 @@ if ($action) {
case 'wrap':
$r1 = $resp[0]->value();
$r2 = $resp[1]->value();
- if ($r2->kindOf() != "array" || $r2->arraysize() <= $methodsig) {
+ if ($r2->kindOf() != "array" || $r2->count() <= $methodsig) {
echo "Error: signature unknown\n";
} else {
$mdesc = $r1->scalarval();
@@ -474,18 +479,17 @@ if ($action) {
if ($proxy == '' && $username == '' && !$requestcompression && !$responsecompression &&
$clientcookies == ''
) {
- $opts = 0; // simple client copy in stub code
+ $opts = 1; // simple client copy in stub code
} else {
- $opts = 1; // complete client copy in stub code
+ $opts = 0; // complete client copy in stub code
}
if ($wstype == 1) {
$prefix = 'jsonrpc';
} else {
$prefix = 'xmlrpc';
}
- //$code = wrap_xmlrpc_method($client, $method, $methodsig, 0, $proto, '', $opts);
$wrapper = new PhpXmlRpc\Wrapper();
- $code = $wrapper->build_remote_method_wrapper_code($client, $method, str_replace('.', '_', $prefix . '_' . $method), $msig, $mdesc, $timeout, $proto, $opts, $prefix);
+ $code = $wrapper->buildWrapMethodSource($client, $method, array('timeout' => $timeout, 'protocol' => $proto, 'simple_client_copy' => $opts, 'prefix' => $prefix), str_replace('.', '_', $prefix . '_' . $method), $msig, $mdesc);
//if ($code)
//{
echo "\n";
@@ -537,6 +541,7 @@ if ($action) {
Changelog
+ - 2015-05-30: fix problems with generating method payloads for NIL and Undefined parameters
- 2015-04-19: fix problems with LATIN-1 characters in payload
- 2007-02-20: add visual editor for method payload; allow strings, bools as jsonrpc msg id
- 2006-06-26: support building php code stub for calling remote methods
|