[phpxmlrpc] problem with proxy connection

Manish Marathe mmarathe at spikesource.com
Thu Jul 5 22:30:02 BST 2007


Hello,

I am having problem when I am trying to make client calls via proxy 
although without proxy it works fine but with proxy it gives me:

xmlrpclib.Fault: <Fault 105: 'XML error: Invalid document end at line 1, 
column 1'>

Any help would be greatly appreciated.

Here is my server code:
------------------------------------------------------------------------------------------------------------

<?php
require_once dirname(__FILE__) . '/../lib/xmlrpc/xmlrpc.inc';
require_once dirname(__FILE__) . '/../lib/xmlrpc/xmlrpcs.inc';
require_once dirname(__FILE__) . '/../site-setup.php';

function getReleaseNotes ($message) {
    global $REPOSITORY_BASE;
    $rollup_release_note_file = $content = $comp_release_note_file = "";

    $info = $files = array();

    $pNameObj = $message->getParam(0);
    $pName = $pNameObj->getVal();

    $pVersionObj = $message->getParam(1);
    $pVersion = $pVersionObj->getval();

    $pPlatformObj = $message->getParam(2);
    $pPlatform = $pPlatformObj->getval();

    $localeObj = $message->getParam(3);
    $locale = $localeObj->getval();

    $dir = $REPOSITORY_BASE . $pName . "/" . $pVersion . "/" . $pPlatform;

    if(is_dir($dir . "/locale/" . $locale)) {
        $files = scan_dir($dir);

        foreach ($files as $file) {
            if(substr($file, -5) === '.yaml') {
                $info = syck_load(file_get_contents($dir . "/" . $file));
                if($info['rollup']['rollup_type'] === 'rollup') {

                    // Release note of the rollup
                    $rollups[$info['rollup']['id']] = $info;
                    if(strtotime($info['rollup']['timestamp']) > 
$recent_timestamp) {
                        $recent_timestamp = 
strtotime($info['rollup']['timestamp']);
                        $rollup_id = intval($info['rollup']['id']);
                    } else {
                        continue;
                    }
                } else {
                    continue;
                }
            }
            $info = array();
        }

        $rollup_release_note_file = 
$rollups[$rollup_id]['rollup']['description'];
        $content .= file_get_contents($dir . "/locale/" . $locale . "/" 
. $rollup_release_note_file) . "\n\n";

        // End release notes of rollup
        // Release notes of dependent components in the rollup yaml
        if(!empty($rollups[$rollup_id]['components'])) {
            foreach($rollups[$rollup_id]['components'] as $component) {
                $comp_release_note_file = $component['description'];
                $content .= file_get_contents($dir . "/locale/" . 
$locale . "/" . $comp_release_note_file) . "\n\n";

                $comp_release_note_file = "";
            }
        }

        return new xmlrpcresp(new xmlrpcval($content, 'base64'));
    } else {
        $msg = "Error! Check Product Name: \"" . $pName . "\", Version: 
\"" . $pVersion
             . "\", Platform: \"" . $pPlatform . "\", and Locale: \"" . 
$locale . "\"\n";
        return new xmlrpcresp(new xmlrpcval($msg, 'string'));
    }
}

function scan_dir($dir) {
    $files = array();

    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            if($file != '.' && $file != '..') {
                $files[] = $file;
            }
        }
        closedir($dh);
    }
    return $files;
}

// Declare our signature and provide some documentation.
// (The PHP server supports remote introspection. Nifty!)
$activate_sig = array(array('struct', 'string', 'string', 'string'),
                      array('string', 'string', 'string', 'string'));
$activate_doc = 'Activates a product';
$checkForUpdates_sig = array(array('base64', 'string', 'string', 'string'),
                             array('string', 'string', 'string', 'string'));
$checkForUpdates_doc = 'Checks for Updates';

$getReleaseNotes_sig = array(array('base64', 'string', 'string', 
'string', 'string'),
                             array('string', 'string', 'string', 
'string', 'string'));
$getReleaseNotes_doc = 'Get Release Note Contents';


$s = new xmlrpc_server(array('activate' =>
                            array('function' => 'activate',
                                  'signature' => $activate_sig,
                                  'docstring' => $activate_doc),
                        'checkForUpdates' =>
                            array('function' => 'checkForUpdates',
                                  'signature' => $checkForUpdates_sig,
                                  'docstring' => $checkForUpdates_doc),
                        'getReleaseNotes' =>
                            array('function' => 'getReleaseNotes',
                                  'signature' => $getReleaseNotes_sig,
                                  'docstring' => $getReleaseNotes_doc)
                        )
                  );
$s->setDebug(3);
?>


More information about the phpxmlrpc mailing list