[geeklog-devel] GL2: using SOAP

Tony Bibbs tony at tonybibbs.com
Thu Mar 20 00:23:16 EST 2003


My gut says stick with PEAR.  the guy developing PEAR::SOAP, Shane 
Craveo is a developer at ActiveState.com and I respect most of his work.

There is a good book by wrox called PHP Web Services that I would recommend.

YOu are on the right track, with SOAP we can have services (free and for 
profit) on gl.net site and users can browse them via WSDL browsing tools.

--Tony

Chris Franklin wrote:
> I've spent some time this week looking at how GL2 can leverage SOAP.
> As per Tony, I see an opportunity to use SOAP in these areas:
> - AA (Authentication and Authorization)
> - communication btwn. geeklog.net and any GL2 installation (a good example
> of this is the new GL2 bug repository but really any RPC that needs to
> happen btwn. geeklog.net and all the GL2 installations.)
> - modules/blocks
> 
> Module/Block developers can use SOAP to take advantage of any available SOAP
> service on the net. To get an idea of what's available, take a look at
> www.xmethods.com. All kinds of great web services available here:
> - news feeds
> - language translation
> - quote of the day
> - map images
> - address finder
> - stock finder
> - zip code info
> - the list goes on and on and is likely getting bigger every day.
> 
> 
> There's 2 main PHP SOAP implementations in use:
> - PEAR:SOAP
> - nusoap
> 
> I started off looking at PEAR:SOAP. It's powerful but is more time consuming
> as you have to manually marshall the data.
> Nosoap is much easier and seems to be more mature. All you have to do is
> write a few lines for the client and server, then just point the client at
> the server. Also, nusoap only requires that you include 1 php file:
> nusoap.php - so it's easily distributable. (See examples below). You can
> also define WSDL's for your SOAP services - haven't tried that yet though.
> Nusoap is found here:
> http://dietrich.ganx4.com/nusoap/index.php
> 
> Does anyone have experience using either of these PHP soap implementations?
> It would be great to get some feedback about this. If not, and you're
> interested to learn more, here's some resources I found (pretty much all
> examples of using nusoap):
> http://www.zend.com/zend/tut/tutorial-campbell.php
> http://www.devarticles.com/art/1/414/3
> http://www.aspbuilder.net/asp/dev_article.asp?aspid=12
> http://www.cs.ucsd.edu/users/elkan/134A/section_021115.html
> http://www.ampoliros.com/en/dev/sdk/soap.txt
> http://www.flash-db.com/services/Example.php
> http://developer.apple.com/internet/webservices/soapphp.html
> 
> 
> If you don't want to read all that, then here's an example of a hello world
> and a request for a dynamic array of bugs (apologies if my php code is not
> proper - still learning the language):
> 
> 
> Here's an example of hello world - (string in, 1 string out):
> ----------------------------------------------------------
> HELLO CLIENT:
> <?php
> // testing 1 string in, 1 string out
> require_once('../nusoap.php');
> $soapclient = new soapclient('http://your-ip-here/nusoap/server/hello.php');
> $soapclient->debug_flag = true;
> echo $soapclient->call('hello', array('name'=>'franchr'));
> ?>
> 
> HELLO SERVER:
> <?php
> require_once('../nusoap.php');
> $server = new soap_server;
> $server->register('hello');
> function hello ($name){
>   // optionally catch an error and return a fault
>   if($name == '') {
>     return new soap_fault('Client','','Must supply a valid name.');
>   }
>   return "Hello $name.";
> }
> $server->service($HTTP_RAW_POST_DATA);
> exit();
> ?>
> ----------------------------------------------------------
> 
> Here's an example of a request for all outstanding bugs (1 dummy string in
> and an array of arrays back):
> BUGS CLIENT:
> ----------------------------------------------------------
> <?php
> // testing 0 strings in, arrays of arrays back out
> require_once('../nusoap.php');
> $soapclient = new soapclient('http://your-ip-here/nusoap/server/bugs.php');
> $soapclient->debug_flag = true;
> $result = $soapclient->call('getBugs', array());
> for($i=0; $i < count($result[0]); $i++) {
>   $bug = $result[0][$i];
>   $retval  = "id: "        . $bug[0] . "<br />";
>   $retval .= "desc: "      . $bug[1] . "<br />";
>   $retval .= "submitter: " . $bug[2] . "<br />";
>   $retval .= "----------<br />";
>   echo $retval;
> }
> ?>
> 
> BUGS SERVER:
> <?php
> require_once('../nusoap.php');
> $server = new soap_server;
> $server->register('getBugs');
> function getBugs($dummy){
>   return stub();
> }
> function stub() {
>   // 0: id
>   // 1: description
>   // 2: submitter
>   return array( array('1', 'where is any key?',  'joeschmo.com'),
>                 array('2', 'does not work!'   ,  'd at blah.com'),
>                 array('3', 'what is config.php?', 'blah at blah.com') );
> }
> $server->service($HTTP_RAW_POST_DATA);
> exit();
> ?>
> ----------------------------------------------------------
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> geeklog-devel mailing list
> geeklog-devel at lists.geeklog.net
> http://lists.geeklog.net/listinfo/geeklog-devel


-- 
+-------------------+--------------------------------------------------+
|Tony Bibbs         |[R]egardless of what you may think of our penal   |
|tony at tonybibbs.com |system, the fact is that every man in jail is one |
|                   |less potential fisherman to clutter up your       |
|                   |favorite pool or pond. --Ed Zern                  | 

+-------------------+--------------------------------------------------+




More information about the geeklog-devel mailing list