Article Using Zend_Soap Server and Autodiscover in a Controller

I am in a dilemma. I have condemned the usage of Zend_Soap_Server (or any other webservice server handler) inside a Model-View-Controller application before. Still I get questions about my old Zend\_Soap\_Server and Zend\_Soap\_AutoDiscover example not working in the MVC scenario. The following example provides you with a working Soap server inside a Zend_Controller_Action, although I discourage the use of it and would suggest using a dedicated script outside the dispatching process to gain multitudes of performance, which webservices often require.

require_once "/path/to/HelloWorldService.php";

class MyDiscouragedSoapServerController extends Zend_Controller_Action
    public function serverAction()
        $server = new Zend_Soap_Server("");

    public function wsdlAction()
        $wsdl = new Zend_Soap_AutoDiscover();

Now all you have to do is create two routes, one that makes** point to MyDiscouragedSoapServerController::serverAction and the other route that makes** point to MyDiscouragedSoapServerController::wsdlAction. The wrong version (Version Mismatch) error comes from sending a request for the WSDL file to the actual Soap Server, which he doesn't like.

Published: 2009-03-11 Tags: #ZendFramework #SOAP