I'm trying to generate a wsdl file using the autodiscover class from the Zend framework. The resulting definition doesn't seem to become available and subsequent functionality doesn't work.
Below is the code that I'm using...
<?php
/**
* Returns Hello World as a string.
*
* @return string
*/
function hello( )
{
return "Hello World";
}
if( isset( $_GET['wsdl'] ) )
{
$autodiscover = new Zend_Soap_AutoDiscover();
$autodiscover->addFunction( 'hello' );
$autodiscover->handle();
}
else if( isset( $_GET['client'] ) )
{
$client = new Zend_Soap_Client( "http://localhost/service.php" );
echo $client->hello();
}
else
{
$server = new Zend_Soap_Server( "http://localhost/service.php?wsdl" );
$server->addFunction( 'hello' );
$server->handle();
}
?>
This all weems to fail silently, calling http://localhost/service.php?wsdl just dies silently and generates no WSDL definition. Could someone please give me an idea of what I'm doing wrong :)
Many thanks
I tried the code you posted, except that I added: require('Zend/Soap/AutoDiscover.php');
. It worked.