RE: Re: Getting an error

"Na, Hoyeol" <[email protected]>
Newsgroups gmane.comp.php.xml-rpc
Message-ID <[email protected]>
try this ......

 <?php
 ob_start();
 include("xmlrpc.inc");
 include("xmlrpcs.inc");
 ob_end_clean();
  
 function GetStateName($params)
 {
     $statenum = $params->getParam(0);
    
     switch($statenum) /* could also use assoc array */
     {
 		case 1: $name="Alabama"; break;
 	    case 50: $name="Wyoming"; break;
 		default: $name="Unknown"; break;
     }
    
     return new xmlrpcresp(new xmlrpcval($name, "string"));
 }
 
 $s=new xmlrpc_server(array("examples.getStateName" => 
 		array("function" => "GetStateName")));
 
 ?>
-----Original Message-----
From: [email protected] [mailto:phpxmlrpc-
[email protected]] On Behalf Of Edd Dumbill
Sent: Monday, September 30, 2002 1:18 AM
To: Gautam Jain
Cc: XML-RPC for PHP Interest List
Subject: [phpxmlrpc] Re: Getting an error


I've copied this mail to the phpxmlrpc mailing list which is the right
place to get help.   Please follow up there.

-- Edd

On Fri, 2002-09-27 at 19:32, Gautam Jain wrote:
> Hi,
> I m trying to build a webservice in Php using xml rpc. So i made a 
> server.php, and client.php. But when i run the client i get the 
> following error:
> 
> ---GOT---
> HTTP/1.1 200 OK
> Server: Microsoft-IIS/5.1
> Date: Fri, 27 Sep 2002 18:32:31 GMT
> Content-type: text/html
> X-Powered-By: PHP/4.2.3
> 
> <br />
> <b>Notice</b>:  Undefined index:  ac in 
> <b>c:\inetpub\wwwroot\PhpWs\xmlrpc.inc</b> on line <b>333</b><br /> 
> <br />
> <b>Warning</b>:  Cannot add header information - headers already sent 
> by (output started at c:\inetpub\wwwroot\PhpWs\xmlrpc.inc:333) in 
> <b>c:\inetpub\wwwroot\PhpWs\xmlrpcs.inc</b> on line <b>178</b><br /> 
> <?xml version="1.0"?> <methodResponse>
> <params>
> <param>
> <value><string>Alabama</string></value>
> </param>
> </params>
> </methodResponse>
> ---END---
> Fault: Code: 2 Reason 'Invalid return payload: enabling debugging to
examine
> incoming payload'
> XML error: junk after document element at line 2 
> 
> 
> How do i solve this error?
> When i run the client on betty.userland.com it works well. The server 
> code is:
> 
> <?php
> include("xmlrpc.inc");
> include("xmlrpcs.inc");
>  
> function GetStateName($params)
> {
>     $statenum = $params->getParam(0);
>    
>     switch($statenum) /* could also use assoc array */
>     {
> 		case 1: $name="Alabama"; break;
> 	    case 50: $name="Wyoming"; break;
> 		default: $name="Unknown"; break;
>     }
>    
>     return new xmlrpcresp(new xmlrpcval($name, "string"));
> }
> 
> $s=new xmlrpc_server(array("examples.getStateName" => 
> 		array("function" => "GetStateName")));
> 
> ?>
> 
> 
> I just pass '1' as the input parameter.
> 
> Can you help me?
> 
> Thanks,
> Gautam Jain.
-- 
Edd Dumbill ----| phone: +44 1904 427740 fax: +44 8709 909625 |-----  |
Managing Editor, XML.com, XMLhack.com  --  Chair, XML Europe 2002  | I
PGP sign my email; more info at http://heddley.com/edd/pgp.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.