private function handleSOAP() { $soap = new \Zend\Soap\Server(self::WSDL_URI); //Setamos a classe no autodiscover com o metodo setClass $soap->setClass('Calculadora'); // Leva pedido do fluxo de entrada padrão $soap->handle(); }
public function indexAction(Request $request) { if ($request->query->has('wsdl')) { $autodiscover = new \Zend\Soap\AutoDiscover(); $autodiscover->setClass('\\Heri\\WebServiceBundle\\Tests\\Server\\Sample'); $autodiscover->setUri('http://my-local/sample/index'); $autodiscover->generate(); return new Response($autodiscover->toXml(), 200, array('Content-Type' => 'application/xml')); } else { $server = new \Zend\Soap\Server('sample.wsdl'); $server->setClass('\\Heri\\WebServiceBundle\\Tests\\Server\\Sample'); $server->handle(); return new Response("", 200, array('Content-Type' => 'application/xml')); } }
* @category Zend * @package Zend_Soap * @subpackage UnitTests * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Server2 { /** * @param string $foo * @param string $bar * @return \ZendTest\Soap\TestAsset\fulltests\ComplexTypeB */ public function request($foo, $bar) { $b = new ComplexTypeB(); $b->bar = $bar; $b->foo = $foo; return $b; } } if(isset($_GET['wsdl'])) { $server = new \Zend\Soap\AutoDiscover(new \Zend\Soap\Wsdl\Strategy\ArrayOfTypeComplex()); } else { $uri = "http://".$_SERVER['HTTP_HOST']."/".$_SERVER['PHP_SELF']."?wsdl"; $server = new \Zend\Soap\Server($uri); } $server->setClass('ZendTest\Soap\TestAsset\fulltests\Server2'); $server->handle();
/** * Starta o WS Server * @return SoapServer Abre o servico */ private function handleSOAP() { // Instancia so ZendSoapServer $soap = new \Zend\Soap\Server($this->ws_url . '?wsdl', array()); // Setta a classe para o servidor $soap->setClass($this->ws_class); // Starta tudo return $soap->handle(); }
<?php $url = "http://localhost/webservice/server.php?wsdl"; if (isset($_GET['wsdl'])) { $autodiscover = new Zend\Soap\AutoDiscover(); $autodiscover->setClass('Serviceclass')->setUri('http://example.com/soap.php'); echo $autodiscover->toXml(); } else { // pointing to the current file here $soap = new Zend\Soap\Server($url); $soap->setClass('Serviceclass'); $soap->handle(); }