[phpxmlrpc] I'm Lost with phpxmlrpc

Gaetano Giunta giunta.gaetano at sea-aeroportimilano.it
Fri Feb 3 14:19:37 GMT 2006


Uhm, I might be getting it wrong, but it looks like you took the code I proposed as used it as-is (almost) in your application.
It was actually meant as an example.

More specifically, If I read it correctly, your XMLRPC looks like this:

ARRAY => {
  STRUCT => {
    ITINERARIO_CODIGO => XXX
  }
}

To access the 'itinerario codigo' data, you need to use not arraymem($i), but rather stuctmem('ITINERARIO_CODIGO')  on line 60, since $sig will be an xmlrpcval of type 'struct' at that point.

I see you are also trying to access 2 members of the struct (member 0 and member 1) on line 59 and line 60, but you only have one.

here's da code:

...
$numvals = $v->arraysize();
for ($i = 0; $i < $numvals; $i++)
{
  $innerval = $v->arraymem($i); // fecth element i of array
  $itinerary_code = $innerval->structmem('ITINERARIO_CODIGO'); // retrieve member out of struct element
  $itinerary_code = $itinerary_code->scalarval(); // get php string out of element
}

etc...
  -----Original Message-----
  From: phpxmlrpc-bounces at lists.usefulinc.com [mailto:phpxmlrpc-bounces at lists.usefulinc.com]On Behalf Of Overpeer ---
  Sent: Friday, February 03, 2006 1:09 PM
  To: phpxmlrpc at lists.usefulinc.com
  Subject: [phpxmlrpc] I'm Lost with phpxmlrpc


  Hello, i probed it but:

  $signum = $v->arraysize();
              for($i = 0; $i < $signum; $i++)
                 {
                   print $i;        
                   $sig = $v->arraymem($i);
                   $paramsnums = $sig->arraysize()-1;
                   $retval = $sig->arraymem(0);
                   $retval = $sig->arraymem(1);    
                                                 
                   print $retval->scalarval();                        // Error here ----- Line 62
                   for ($j = 1; $j <= $paramsnums; $j++)
                     {
                        $param = $sig->arraymem($j);
                        echo "  Param number $j must be of type:".$param->scalarval()."\n";
                     }
                            
                   }                

  The error is: Fatal error: Call to a member function on a non-object in /var/www/localhost/htdocs/client.php on line 62

  The xml-rpc incoming is: 

  <?xml version="1.0"?>
  <methodResponse>
     <params>
     <param>
  <value>
    <array>
      <data>
  <value>
    <struct>
      <member>
        <name>ITINERARIO_CODIGO</name>
        <value><string>311</string></value>
      </member>
    </struct>
  </value>

  <value>
    <struct>
      <member>
        <name>ITINERARIO_CODIGO</name>
        <value><string>310</string></value>
      </member>
    </struct>
  </value>

    </data>
  </array>
  </value>

     </param>
     </params>
  </methodResponse>


  Some idea??? :S :S

  A lot of thanks 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.gnomehack.com/pipermail/phpxmlrpc/attachments/20060203/f7867b28/attachment.htm


More information about the phpxmlrpc mailing list