01-13-2010, 02:50 PM
|
#2 (permalink)
|
|
The Wanderer
Join Date: Jan 2010
Posts: 7
Thanks: 0
|
It's quite easy to add wdsl support. Here's a quick example:
PHP Code:
class Api_SoapController extends Zend_Controller_Action
{
/**
* Process all incoming SOAP requests
*
* @return void
*/
public function indexAction()
{
// extract wsdl parameter
$wsdl = $this->_getParam('wsdl', null);
$wsdl = ($wsdl !== null);
// handle request
if ($wsdl === true) {
$server = new Zend_Soap_AutoDiscover();
} else {
$protocol = strtolower(array_shift(explode('/', $_SERVER['SERVER_PROTOCOL'])));
$wsdl_url = sprintf('%s://%s/api/soap?wsdl', $protocol, $_SERVER['HTTP_HOST']);
$server = new Zend_Soap_Server($wsdl_url);
// ...
// add all your classes
// $server->setClass('class', 'namespace');
// ...
print $server->handle();
}
}
}
Something like that. I haven't tested the code, just compiled it from different locations I have (I have it in a more complex way).
So in this case your post url is
http://yourdomain.com/api/soap
and your wsdl url is
http://yourdomain.com/api/soap?wsdl
Hope that helps
|
|
|
|