RE: [phpxmlrpc] Read the XML File

2006-09-15 Thread Gaetano Giunta



Sorry, 
but I think you should really start by reading the manual (it is very complete 
and informative) and take a look at all the code examples that are part of the 
download.
 
As a 
php developer, the php error message you receive would tell me that the 
$data_to_be_saved 
variable is not what you expect it to be (namely an xmlrpcval 
object), so, in order to debug the code I would just add this 
line:
var_dump($data_to_be_saved);
to 
find out what is going on.
 
To 
spare you the trouble of doing it, I can tell you that $resp->serialize() returns a string (the xml 
representation of the response), while $resp->value() returns the value received as 
xmlrpcval object.
 
Bye
Gaetano

  -Original Message-From: kutty S.B. 
  [mailto:[EMAIL PROTECTED]Sent: Friday, September 15, 2006 
  6:56 AMTo: Gaetano GiuntaSubject: RE: [phpxmlrpc] Read 
  the XML File
  hi
   
    Thank u very much.
   
  $data_to_be_saved = 
  $resp->serialize();
   
  It is show the full result.
   
  But I try to get some particular value like
   
   $struct = $data_to_be_saved->value(); $sumval = 
  $struct->structmem('sum'); $sum = 
  $sumval->scalarval();
   
   I got following error
   
    Fatal error: Call to a member function on a 
  non-object in  "$struct = 
  $data_to_be_saved->value()";
   
  How i receive  the particular value.
   
  Thanks in advance.
   
  Gaetano Giunta 
  <[EMAIL PROTECTED]> wrote:
  

I 
am not really sure I undertand what you are asking...
 
If 
what you need is to save the responses received from the server as xml, you 
have two options:
 
1- 
use the serialize() method on the response object.
 
$resp = $client->send($msg);
if 
(!$resp->faultCode())
  $data_to_be_saved = 
$resp->serialize();
  etc...
 
Note that this will not be 100% accurate, since the 
xml generated by the response object can be different from the xml received, 
especially if there is some character set conversion involved, or such (eg. 
if you receive an empty string tag as , serialize() will 
output ), or if the server sent back as 
response something invalid (in which case the xml generated client side 
using serialize() wil correspond to the error response generated internally 
by the lib)
 
 
2 
- set the client object to return the raw xml received instead of the 
decoded objects:
 
$client = new 
xmlrpc_client($whatever);
$client->return_type = 'xml'
$resp = $client->send($msg);

if 
(!$resp->faultCode())
  $data_to_be_saved = 
$resp->value();
  etc...
 
Note that using this method the xml response 
response will not be parsed at all by the library, only the http 
commuincation will be checked. This means that xmlrpc responses sent by the 
server that would have generated an error response on the client (eg. 
malformed xml, responses that have faultcode/faultmsg set, etc...) 
now.
 
Hope this helps
Gaetano
 

  -Original Message-From: 
  [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED]On Behalf Of kutty 
  S.B.Sent: Thursday, September 14, 2006 11:49 AMTo: 
  phpxmlrpc@lists.usefulinc.comSubject: [phpxmlrpc] Read the XML 
  File
  Hi all,
   
       I connect to Server and 
  got the response from server.
   
  how i write the result into the xml files.
   
  It is Possible??
   
  Thanks in advance
   
   
   
  
  
  Find out what India is talking about on - Yahoo! 
  Answers India Send FREE SMS to your friend's mobile from Yahoo! 
  Messenger Version 8. Get 
  it 
NOW___phpxmlrpc 
mailing 
listphpxmlrpc@lists.usefulinc.comhttp://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc
  
  
  Find out what India is talking about on - Yahoo! 
  Answers India Send FREE SMS to your friend's mobile from Yahoo! 
  Messenger Version 8. Get 
  it NOW
___
phpxmlrpc mailing list
phpxmlrpc@lists.usefulinc.com
http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc


RE: [phpxmlrpc] Read the XML File

2006-09-14 Thread Gaetano Giunta



I am 
not really sure I undertand what you are asking...
 
If 
what you need is to save the responses received from the server as xml, you have 
two options:
 
1- use 
the serialize() method on the response object.
 
$resp 
= $client->send($msg);
if 
(!$resp->faultCode())
  
$data_to_be_saved = $resp->serialize();
  
etc...
 
Note 
that this will not be 100% accurate, since the xml generated by the response 
object can be different from the xml received, especially if there is some 
character set conversion involved, or such (eg. if you receive an empty string 
tag as , serialize() will output 
), or if the server sent back as response something 
invalid (in which case the xml generated client side using serialize() wil 
correspond to the error response generated internally by the 
lib)
 
 
2 - 
set the client object to return the raw xml received instead of the decoded 
objects:
 
$client = new 
xmlrpc_client($whatever);
$client->return_type = 'xml'
$resp 
= $client->send($msg);

if 
(!$resp->faultCode())
  
$data_to_be_saved = $resp->value();
  
etc...
 
Note 
that using this method the xml response response will not be parsed at all by 
the library, only the http commuincation will be checked. This means that xmlrpc 
responses sent by the server that would have generated an error response on the 
client (eg. malformed xml, responses that have faultcode/faultmsg set, etc...) 
now.
 
Hope 
this helps
Gaetano
 

  -Original Message-From: 
  [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED]On Behalf Of kutty 
  S.B.Sent: Thursday, September 14, 2006 11:49 AMTo: 
  phpxmlrpc@lists.usefulinc.comSubject: [phpxmlrpc] Read the XML 
  File
  Hi all,
   
       I connect to Server and got 
  the response from server.
   
  how i write the result into the xml files.
   
  It is Possible??
   
  Thanks in advance
   
   
   
  
  
  Find out what India is talking about on - Yahoo! 
  Answers India Send FREE SMS to your friend's mobile from Yahoo! 
  Messenger Version 8. Get 
  it NOW
___
phpxmlrpc mailing list
phpxmlrpc@lists.usefulinc.com
http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc