Location: PHPKode > projects > Taxonomic Search Engine > webservice.php
<title>Taxonomic Search Engine</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="portal.css" type="text/css" media="screen" /> 


<h1>Taxonomic Search Engine - Web service</h1>
<h2>Federating taxonomic databases using web services</h2>
<?php include("top.inc.php"); ?>

<h2>Webservice interface</h2>
<p>An experimental web service interface is being added to the Taxonomic Search Engine. You can view the 
<a href="http://darwin.zoology.gla.ac.uk/~rpage/portal/TSE.php" target= "_blank">service description</a>, or get a copy of the <a href="http://darwin.zoology.gla.ac.uk/~rpage/portal/TSE.php?wsdl" target=_blank">
WSDL file</a>.</p>


<h3>Look up a name</h3>

<p> Here is a very simple perl client that uses the SOAP::Lite toolkit to search on a single name (&quot;Aerodramus&quot;). The
return is an XML document.</p>

<pre  class="sourcecodebox">
#!/usr/bin/perl -w
use SOAP::Lite;
use XML::XPath;

# Add a HTP proxy if your connection to the Internet is through a proxy server
#$ENV{HTTP_proxy} = "http://wwwcache.gla.ac.uk:8080/";

my $TSE_WSDL = 'http://darwin.zoology.gla.ac.uk/~rpage/portal/TSE.php?wsdl';

# Create SOAP client
my $s = SOAP::Lite
        ->service ($TSE_WSDL);
my $result = $s->NameSearch('Aerodramus');
print $result;

<h3>Find near matches</h3>
<p>The following client calls the web service to find approximate matches to a name. This
service uses agrep to find approximate matches in a flat file list of names, and also uses
the <a href="http://www.google.com/apis/" target="_blank">Google API</a>.

<p>In this example, the client searches on the name &quot;Cephalorhynchus commersoni&quot;, and
the service returns &quot;Cephalorhynchus commersoni<b>i</b>&quot; (note the extra &quot;i&quot;
at the end of the name).</p>

<pre  class="sourcecodebox">
#!/usr/bin/perl -w
# Search for  names in TSE
use strict;
use warnings;

use SOAP::Lite;    # SOAP API

# Add a HTP proxy if your connection to the Internet is through a proxy server
#$ENV{HTTP_proxy} = "http://wwwcache.gla.ac.uk:8080/";

# Initialise the web service
my $s = SOAP::Lite
 -> proxy('http://darwin.zoology.gla.ac.uk/~rpage/portal/TSE.php');

# Name to search for
my $name = "Cephalorhynchus commersoni";

my $result = $s->SpellingSuggestion($name);

if ($result->match('//SpellingSuggestionResponse/return/item'))
	print "Suggestions for \"$name\":\n";
	my @suggestions = $result->valueof('//SpellingSuggestionResponse/return/item');
	# A simple foreach read the array
	foreach my $suggestion (@suggestions) {
	  print "   $suggestion\n";

<p>The service uses <a href="http://dietrich.ganx4.com/nusoap/index.php"  target="_blank">NuSOAP</a> to generate a
WSDL file on the fly (see <a href="http://www.scottnichol.com/soap.htm" target="_blank">Scott Nichol's pages</a> 
on how to do this). Mindreef <a href="http://www.mindreef.com/" target= "_blank">SOAPscope</a> was used to test the service. The 
<a href="http://chart.stsci.edu/twiki/bin/view/Main/Software" target="_blank">hide@address.com</a> package of AXIS, ANT, and other tools
was used to provide a simple way to get these tools installed so I could use <b>wsdl2java</b> to test the WSDL file (note
that this is no guarantee that the generated Java code actually works). Thanks to <a href="http://www.cs.umb.edu/~ram/" target="_blank">Bob Morris</a>
for pointing out problems with the original WSDL file.
Return current item: Taxonomic Search Engine