2008年8月15日星期五

[fw-webservices] Re: Building a MVC-based Soap server

Sorry for bumping this, but I´m still trying to make this work.

Didn´t anyone built a soap sever using MVC architeture?

On Thu, Aug 14, 2008 at 9:28 AM, Luiz Vitor <prowler666@gmail.com> wrote:
Hi there

I´m trying to build a soap server using the ZF MVC architeture, but I can´t get it to work.

I have a Service model used as a gateway between the soap server and the application logic.

class Services
{
    /**
     * Verify user credentials
     *
     * @param string $username
     * @param string $password
     * @return bool
     */
    public function authenticate($username, $password)
    {
        // code to authenticate
    }
}


On the other part, I have a ServiceController which I setup the wsdl autodiscover and server

class ServiceController extends Zend_Controller_Action
{
    public function wsdlAction()
    {
        $wsdl = new Zend_Soap_Wsdl();
        $wsdl->setClass('Services');
        $wsdl->handle();
        exit;
    }


    public function serverAction()
    {
        $server = new Zend_Soap_Server('http://myhost.com/service/wsdl/');
        $server->setClass('Services');
        $server->handle();
        exit;
    }
}

Up to now everything works as expected, when I access http://myhost.com/service/wsdl/ I get the XML describing the Service class.

Now comes the problem: I can´t make any requests to the server. Here´s what I´m trying:

$client = new Zend_Soap_Client('http://myhost.com/service/server'); // tryied http://myhost.com/service/wsdl/ too with no success
Zend_Debug::dump($client->authenticate('user', 'pass');

But the service is never called.

What I´m doing wrong?

Thank you

没有评论: