PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Functions autodiscovering

If set of functions are used to provide SOAP server functionality, then the same set should be provided to Zend_Soap_AutoDiscovery for WSDL generation:

<?php
$autodiscover 
= new Zend_Soap_AutoDiscover();
$autodiscover->addFunction('function1');
$autodiscover->addFunction('function2');
$autodiscover->addFunction('function3');
...
$autodiscover->handle();

The following rules are used while WSDL generation:

  • Generated WSDL describes an RPC style Web Service.

  • Current script name is used as a name of the Web Service being described.

  • 'http://' .$_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] is used as an URI where the WSDL is available.

    It's also used as a target namespace for all service related names (including described complex types).

  • Functions are joined into one Port Type.

    $functionName . 'Port' is used as Port Type name.

  • Each function is registered as a corresponding port operation.

  • Each function prototype generates corresponding Request/Response messages.

    Function may have several prototypes if some method parameters are optional.

Important!

WSDL autodiscovery utilizes the PHP docblocks provided by the developer to determine the parameter and return types. In fact, for scalar types, this is the only way to determine the parameter types, and for return types, this is the only way to determine them.

That means, providing correct and fully detailed docblocks is not only best practice, but is required for discovered class.

Zend Framework