XML_RPC_Response fatal error: Call to undefined method kindof

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ming

    #1

    XML_RPC_Response fatal error: Call to undefined method kindof

    I am new to php5 programming :)

    I redirect users to another server to login. After they login
    successfully, they will be redirected to test.php. The server provides
    xml_rpc interface so I can communicate with it. After running my
    scripts, I get this error:

    Fatal error: Call to undefined method XML_RPC_Respons e::kindOf() in /
    usr/share/PEAR/XML/RPC.php on line 1972

    It seems it is these two lines that cause problems:

    I do get some response from the server, though.

    The followings are my scripts:

    test.php

    <?php

    error_reporting (E_ALL);
    ini_set('displa y_errors', true);

    include("cwl.ph p");

    $test=new cwl();

    $test->test();

    ?>


    cwl.php

    <?php

    require 'XML/RPC.php';
    error_reporting (E_ALL);
    ini_set('displa y_errors', true);

    class cwl{

    private $cwlURL;
    private $xmlrpcPath;
    private $appID;
    private $appIDPassword;
    private $cwlClient;
    private $sessionTicket;
    private $params;


    function __construct()
    {
    $this->appID='xxx';
    $this->appIDPassword= 'xxx';
    $this->xmlrpcPath='/path';
    $this->cwlURL='someur l;
    $this->sessionTicket= $_GET['ticket'];
    $this->params=array ( new XML_RPC_Value($ this->sessionTicke t,
    'string'));
    $this->cwlClient=$thi s->getCWLClient() ;
    }

    private function getCWLClient()
    {
    $client=new XML_RPC_Client( $this->xmlrpcPath, $this->cwlURL);
    $client->setCredentia ls ($this->appID, $this->appIDPassword) ;
    $client->setDebug(1);
    return $client;
    }

    protected function makeCall($funct ionName)
    {
    $functionName=' session.'.$func tionName;

    try
    {
    $msg = new XML_RPC_Message ($functionName, $this->params);
    $resp= new XML_RPC_Respons e(new XML_RPC_Value() );
    $resp= $this->cwlClient->send($msg);
    return $resp;


    }
    catch (Exception $e)
    {
    $e->__toString() ;
    }
    }


    public function test()
    {
    $val =new XML_RPC_Value() ;
    $val = $this->makeCall('getI dentities');


    //*************** ************
    //It seems it the line below causes the problem

    $data = XML_RPC_decode( $val);
    echo "<br>";

    if (isset($data['student_number ']))
    echo $data['student_number ']."<br>";
    else echo "Not a student<br>";

    if (isset($data['employee_numbe r']))
    echo $data['employee_numbe r']."<br>";
    else echo "Not an employee<br>";

    }
    }

    ?>

    Any advice? Thanks,

  • Ming

    #2
    Re: XML_RPC_Respons e fatal error: Call to undefined method kindof

    A quick follow-up:

    Never mine. I got it fixed.

    Comment

    • Mike P2

      #3
      Re: XML_RPC_Respons e fatal error: Call to undefined method kindof

      On May 16, 1:02 pm, Ming <minghu...@gmai l.comwrote:
      I am new to php5 programming :)
      >
      I redirect users to another server to login. After they login
      successfully, they will be redirected to test.php. The server provides
      xml_rpc interface so I can communicate with it. After running my
      scripts, I get this error:
      >
      Fatal error: Call to undefined method XML_RPC_Respons e::kindOf() in /
      usr/share/PEAR/XML/RPC.php on line 1972
      >
      It seems it is these two lines that cause problems:
      >
      I do get some response from the server, though.
      >
      The followings are my scripts:
      >
      test.php
      >
      <?php
      >
      error_reporting (E_ALL);
      ini_set('displa y_errors', true);
      >
      include("cwl.ph p");
      >
      $test=new cwl();
      >
      $test->test();
      >
      ?>
      >
      cwl.php
      >
      <?php
      >
      require 'XML/RPC.php';
      error_reporting (E_ALL);
      ini_set('displa y_errors', true);
      >
      class cwl{
      >
      private $cwlURL;
      private $xmlrpcPath;
      private $appID;
      private $appIDPassword;
      private $cwlClient;
      private $sessionTicket;
      private $params;
      >
      function __construct()
      {
      $this->appID='xxx';
      $this->appIDPassword= 'xxx';
      $this->xmlrpcPath='/path';
      $this->cwlURL='someur l;
      $this->sessionTicket= $_GET['ticket'];
      $this->params=array ( new XML_RPC_Value($ this->sessionTicke t,
      'string'));
      $this->cwlClient=$thi s->getCWLClient() ;
      }
      >
      private function getCWLClient()
      {
      $client=new XML_RPC_Client( $this->xmlrpcPath, $this->cwlURL);
      $client->setCredentia ls ($this->appID, $this->appIDPassword) ;
      $client->setDebug(1);
      return $client;
      }
      >
      protected function makeCall($funct ionName)
      {
      $functionName=' session.'.$func tionName;
      >
      try
      {
      $msg = new XML_RPC_Message ($functionName, $this->params);
      $resp= new XML_RPC_Respons e(new XML_RPC_Value() );
      $resp= $this->cwlClient->send($msg);
      return $resp;
      >
      }
      catch (Exception $e)
      {
      $e->__toString() ;
      }
      }
      >
      public function test()
      {
      $val =new XML_RPC_Value() ;
      $val = $this->makeCall('getI dentities');
      >
      //*************** ************
      //It seems it the line below causes the problem
      >
      $data = XML_RPC_decode( $val);
      cwl::makeCall() is probably not returning an XML_RPC_Value object.
      Refer to XML_RPC_Client: :send() in XML/RPC.php to make sure it returns
      an XML_RPC_Value object.

      -Mike PII

      Comment

      • Mike P2

        #4
        Re: XML_RPC_Respons e fatal error: Call to undefined method kindof

        On May 16, 4:04 pm, Mike P2 <sumguyovrt...@ gmail.comwrote:
        On May 16, 1:02 pm, Ming <minghu...@gmai l.comwrote:
        >
        >
        >
        I am new to php5 programming :)
        >
        I redirect users to another server to login. After they login
        successfully, they will be redirected to test.php. The server provides
        xml_rpc interface so I can communicate with it. After running my
        scripts, I get this error:
        >
        Fatal error: Call to undefined method XML_RPC_Respons e::kindOf() in /
        usr/share/PEAR/XML/RPC.php on line 1972
        >
        It seems it is these two lines that cause problems:
        >
        I do get some response from the server, though.
        >
        The followings are my scripts:
        >
        test.php
        >
        <?php
        >
        error_reporting (E_ALL);
        ini_set('displa y_errors', true);
        >
        include("cwl.ph p");
        >
        $test=new cwl();
        >
        $test->test();
        >
        ?>
        >
        cwl.php
        >
        <?php
        >
        require 'XML/RPC.php';
        error_reporting (E_ALL);
        ini_set('displa y_errors', true);
        >
        class cwl{
        >
        private $cwlURL;
        private $xmlrpcPath;
        private $appID;
        private $appIDPassword;
        private $cwlClient;
        private $sessionTicket;
        private $params;
        >
        function __construct()
        {
        $this->appID='xxx';
        $this->appIDPassword= 'xxx';
        $this->xmlrpcPath='/path';
        $this->cwlURL='someur l;
        $this->sessionTicket= $_GET['ticket'];
        $this->params=array ( new XML_RPC_Value($ this->sessionTicke t,
        'string'));
        $this->cwlClient=$thi s->getCWLClient() ;
        }
        >
        private function getCWLClient()
        {
        $client=new XML_RPC_Client( $this->xmlrpcPath, $this->cwlURL);
        $client->setCredentia ls ($this->appID, $this->appIDPassword) ;
        $client->setDebug(1);
        return $client;
        }
        >
        protected function makeCall($funct ionName)
        {
        $functionName=' session.'.$func tionName;
        >
        try
        {
        $msg = new XML_RPC_Message ($functionName, $this->params);
        $resp= new XML_RPC_Respons e(new XML_RPC_Value() );
        $resp= $this->cwlClient->send($msg);
        return $resp;
        >
        }
        catch (Exception $e)
        {
        $e->__toString() ;
        }
        }
        >
        public function test()
        {
        $val =new XML_RPC_Value() ;
        $val = $this->makeCall('getI dentities');
        >
        //*************** ************
        //It seems it the line below causes the problem
        >
        $data = XML_RPC_decode( $val);
        >
        cwl::makeCall() is probably not returning an XML_RPC_Value object.
        Refer to XML_RPC_Client: :send() in XML/RPC.php to make sure it returns
        an XML_RPC_Value object.
        >
        -Mike PII
        Sorry, my post was delayed. Didn't see your follow-up until after it
        went through.

        -Mike PII

        Comment

        Working...