Page 1 of 1

PEAR:SOAP and PHP5

PostPosted: 14. October 2005 16:42
by hakaa
We are now exploring how we can use PHP in Web services development.
We have without problems installed XAMPP on Windows XP, Mac OS and Linux.

Starting up with examples from the books: "Professional PHP Web services" (WROX) and "PHP5 Power Programming"(Prentice Hall PTR) XAMPP seems to miss everything.

Do we have to install everything in PEAR from scratch ?
Is there no automated downloads in XAMPP handling Web services and SOAP?

BR Hans A. Kielland Aanesen

PostPosted: 14. October 2005 16:58
by Wiedmann
XAMPP seems to miss everything.

example?

PostPosted: 14. October 2005 21:03
by Wiedmann
The first fatal error on both Linux and Windows is that the SOAP-classes does not exsist. We have now downloaded SOAP from PEAR for Linux, but then a new pakage is missing (HTTP).

First, i don't know anything about XAMPP/Linux. So let us talk about Windows (but it's similar in Linux):
You want use PEAR::SOAP. So let me look. According to the PEAR-Manual:
Code: Select all
pear.bat list

OK. No package SOAP installed.

Code: Select all
pear.bat search soap

Oh, only a beta package is availible. No stable. --> XAMPP have no beta packages included.

Code: Select all
pear.bat  install -f soap

"-f" because it's a beta package.
--> now you can use PEAR::SOAP

Script example:
require('SOAP/Client.php');
[snip]
<b>C:\XAMPP\xampp\htdocs\ex\Google SOAP kall.php</b> on line
[snip]


I think PEAR::SOAP is not working with the Google API at the moment. But, i never used SOAP before.

So i make the next test with NuSOAP (and not with PEAR::SOAP).
Code: Select all
<?php

   require_once('nusoap.php');

   $parameters = array(
      'key' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
      'q' => 'xampp',
      'start' => 0,
      'maxResults' => 5,
      'filter' => true,
      'restrict' => '',
      'safeSearch' => true,
      'lr' => '',
      'ie' => '',
      'oe' => ''
   );

   $soapclient = new soapclient('http://api.google.com/search/beta2');

   $results = $soapclient->call('doGoogleSearch', $parameters, 'urn:GoogleSearch');

   echo '<pre>';
   print_r($results);
   echo '</pre>';
?>


Hey, that's working fine :-)

BTW:
You can also enable the SOAP-Extension in "php.ini". This extension is included in XAMPP/Windows.

PEAR::SOAP and PHP5

PostPosted: 15. October 2005 21:19
by hakaa
Thank you for response !
I got a litle further regarding missing PEAR packager and how to install them.

Your example helped me to see that the right packages was installed.

HTTP_Request stable ( was installed)
Mail_Mime stable ( was installed)
Net_Dime Beta ( needed to be installed )
Net_Url stable ( was installed)

Soap Beta ( needed to be installed )

I stll got the same fatal error regarding SOAP\Client.php .

The reason we are using PEAR::SOAP is that this is the defacto standard for SOAP development in PHP and is the most object oriented version.

Best regards
Hans

PostPosted: 16. October 2005 08:22
by Wiedmann
I stll got the same fatal error regarding SOAP\Client.php.

On Windows or Linux? On Windows i have no "fatal error" while using PEAR::SOAP.

But you remeber? At the moment you can not use PEAR::SOAP with the Google API. (not with the latest PEAR::SOAP).

So i think it's a good idea to use another well known and stable soap class: NuSOAP.