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

Class autodiscovering

If class is used to provide SOAP server functionality, then the same class should be provided to Zend_Soap_AutoDiscover for WSDL generation:

<?php
$autodiscover 
= new Zend_Soap_AutoDiscover();
$autodiscover->setClass('My_SoapServer_Class');
$autodiscover->handle();

The following rules are used while WSDL generation:

  • Generated WSDL describes an RPC style Web Service.

  • Class 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 by default but can be overwritten via setUri() method.

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

  • Class methods are joined into one Port Type.

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

  • Each class method is registered as a corresponding port operation.

  • Each method prototype generates corresponding Request/Response messages.

    Method 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