Location: PHPKode > projects > Taxonomic Search Engine > TSE.php
<?php

include ('namesearch.php');
include ('agrep.php');
include('google.php');

$s = new soap_server;

$NAMESPACE = 'http://darwin.zoology.gla.ac.uk/~rpage/portal';

// Initialize WSDL support
$s->configureWSDL('TSE', $NAMESPACE);

// Put the WSDL schema types in the namespace with the tns prefix
$s->wsdl->schemaTargetNamespace = $NAMESPACE; 

$s->wsdl->addComplexType(
	'ArrayOfString',
	'complexType',
	'array',
	'',
	'SOAP-ENC:Array',
	array(),
	array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'xsd:string[]')),
	'xsd:string'
	);


// Register method(s)
$s->register('NameSearch',
		array('search_string' => 'xsd:string'),     // input parameters
		array('return' => 'xsd:string'),      		// output parameters
		$NAMESPACE,                      			// namespace
		$NAMESPACE . '#NameSearch',                	// soapaction
		'rpc',                                		// style
		'literal',                            		// use
		'Search for a name' 	           			// documentation 
		);

$s->register('SpellingSuggestion',
		array('search_string' => 'xsd:string'),
		array('return' => 'tns:ArrayOfString'),
		$NAMESPACE,
		$NAMESPACE . '#SpellingSuggestion',
		'rpc',
		'literal',
		'Suggest alternative spellings for a name'
		);


function SpellingSuggestion ($search_string)
{
	$result = array();
	$num = agrep ('namelist.txt', $search_string, $result);
	if ($num == 0)
	{
		$google = GoogleSpelling ($search_string);
		if ($google != "")
			array_push ($result, $google);
	}
	return $result;
}

$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$s->service($HTTP_RAW_POST_DATA);
exit();

?>
Return current item: Taxonomic Search Engine