I installed IIS in my windows. Then I installed PHP (4.3.9 by installer). I tryed php pages and it wokk fine.

Then I put xmlrpc for php directory in D:\Inetpub\wwwroot\php .
Afeter this I create two files:

sample.php:
<?php
   include 'xmlrpc.inc';
   include 'xmlrpcs.inc';

   function sumAndDifference ($params) {

       // Parse our parameters.
       $xval = $params->getParam(0);
       $x = $xval->scalarval();
       $yval = $params->getParam(1);
       $y = $yval->scalarval();

       // Build our response.
       $struct = array('sum' => new xmlrpcval($x + $y, 'int'),
                       'difference' => new xmlrpcval($x - $y, 'int'));
       return new xmlrpcresp(new xmlrpcval($struct, 'struct'));
   }

   // Declare our signature and provide some documentation.
   // (The PHP server supports remote introspection. Nifty!)
   $sumAndDifference_sig = array(array('struct', 'int', 'int'));
   $sumAndDifference_doc = 'Add and subtract two numbers';

   new xmlrpc_server(array('sample.sumAndDifference' =>
                           array('function' => 'sumAndDifference',
                                 'signature' => $sumAndDifference_sig,
                                 'docstring' => $sumAndDifference_doc)));
   ?>

and sumAndDifference2.php:
<html>
   <head>
   <title>XML-RPC PHP Demo</title>
   </head>
   <body>
   <h1>XML-RPC PHP Demo</h1>

   <?php
   include 'xmlrpc.inc';

   // Make an object to represent our server.
   $server = new xmlrpc_client('/php/sample.php',
                               'localhost', 80);

   // Send a message to the server.
   $message = new xmlrpcmsg('sample.sumAndDifference',
                            array(new xmlrpcval(5, 'int'),
                                  new xmlrpcval(3, 'int')));
   $result = $server->send($message);

   // Process the response.
   if (!$result) {
       print "<p>Could not connect to HTTP server.</p>";
   } elseif ($result->faultCode()) {
       print "<p>XML-RPC Fault #" . $result->faultCode() . ": " .
           $result->faultString();
   } else {
       $struct = $result->value();
       $sumval = $struct->structmem('sum');
       $sum = $sumval->scalarval();
       $differenceval = $struct->structmem('difference');
       $difference = $differenceval->scalarval();
       print "<p>Sum: " . htmlentities($sum) .
           ", Difference: " . htmlentities($difference) . "</p>";
   }
   ?>
After this I put xmlrpc.inc and xmlrpcs.inc into D:\Inetpub\wwwroot\php

After this I opened browser (IE) and enter localhost/php/sumAndDifference2.php, then execute and recibe this message:

XML-RPC PHP Demo
XML error: junk after document element at line 2
XML-RPC Fault #2:

I don't understand why it doesn't work.

Anyone knows what is my mistake?

Please help me, I tryed make a webservice and I can not begin it.

Thanks for you attention, keroppi.

_________________________________________________________________
La información más fresca desde diferentes puntos de vista en la Revista de Prensa de MSN. http://es.newsbot.msn.com/



_______________________________________________ phpxmlrpc mailing list [EMAIL PROTECTED] http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc

Reply via email to