1

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

Charles
  • 50,943
  • 13
  • 104
  • 142
Gary Paluk
  • 1,038
  • 1
  • 14
  • 28

3 Answers3

2

I tried the code you posted, except that I added: require('Zend/Soap/AutoDiscover.php');. It worked.

Johnny Everson
  • 8,343
  • 7
  • 39
  • 75
1

Try adding docblocking to the hello function. the WSDL generator relies on it to generate proper WSDL file. http://framework.zend.com/manual/en/zend.soap.autodiscovery.html See the important notes in that link.

Bob Baddeley
  • 2,264
  • 1
  • 16
  • 22
  • I placed the following block comment above the hello() method: /** * Returns Hello World as a string. * * @return string */ It still does nothing. :| – Gary Paluk Jan 13 '11 at 16:56
0

Yep, you are missing require('Zend/Soap/AutoDiscover.php'); that's all.

Tash Pemhiwa
  • 7,590
  • 4
  • 45
  • 49