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();
$a->baz[] = $b2; $a->baz[] = $request; return array($a); } } class ComplexTypeB { /** * @var string */ public $bar; /** * @var string */ public $foo; } class ComplexTypeA { /** * @var \ZendTest\Soap\TestAsset\fulltests\ComplexTypeB[] */ public $baz = array(); } if (isset($_GET['wsdl'])) { $server = new \Zend\Soap\AutoDiscover(new \Zend\Soap\Wsdl\ComplexTypeStrategy\ArrayOfTypeComplex()); } else { $uri = "http://" . $_SERVER['HTTP_HOST'] . "/" . $_SERVER['PHP_SELF'] . "?wsdl"; $server = new \Zend\Soap\Server($uri); } $server->setClass('\\ZendTest\\Soap\\TestAsset\\fulltests\\Server1'); $server->handle();
* @param string $param2 * @param string $param1 * @param string $param3 * @return string */ function test($param2, $param1, $param3) { return 'test1 ' . $param1 . ' test2 ' . $param2 . ' test3 ' . $param3; } /** * Displays the Tiki_ComplexType data. * * @param Tiki_ComplexType $complex_param * @return string */ function test_complex(Tiki_ComplexType $complex_param) { return $complex_param->param1 . ' =====> ' . $complex_param->param2; } } if (is_null($_GET['wsdl'])) { $protocol = isset($_SERVER['HTTPS']) ? 'https' : 'http'; $server = new Zend\Soap\Server($protocol . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'] . '?wsdl'); $server->setClass('Tiki_WebServices'); $server->handle(); } else { $wsdl = new Zend\Soap\AutoDiscover(); $wsdl->setUri($_SERVER['SCRIPT_NAME']); $wsdl->setClass('Tiki_WebServices'); $wsdl->handle(); }
class educacion { /** * @return Universidad[] arrayOfLetters */ public function universidad() { $arreglo[] = array("cod_institucion" => '000001', "siglas" => 'UCV', "cod_carrera" => '006'); $arreglo[] = array("cod_institucion" => '000002', "siglas" => 'UCV', "cod_carrera" => '007'); $arreglo[] = array("cod_institucion" => '000003', "siglas" => 'UNEFA', "cod_carrera" => '008'); return $arreglo; } } /* load framework ZF2 */ set_include_path('/srv/www/io/ZendFramework-2.3.2/library'); require_once 'Zend/Loader/StandardAutoloader.php'; $loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true)); $loader->registerPrefix('Zend', '/srv/www/io/ZendFramework-2.3.2/library'); $loader->register(); /* class autodiscover and Zend\Soap\Server */ if (isset($_GET['wsdl'])) { $strategy = new Zend\Soap\Wsdl\ComplexTypeStrategy\ArrayOfTypeComplex(); $server = new Zend\Soap\AutoDiscover($strategy); $server->setServiceName('WebServiceEducacion'); } else { $server = new Zend\Soap\Server(); } $uri = 'http://webservice.io/HelloWorld/server.php'; $server->setClass('educacion'); $server->setUri($uri); $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(); }
$a->baz[] = $b2; $a->baz[] = $request; return array($a); } } class Zend_Soap_Wsdl_ComplexTypeB { /** * @var string */ public $bar; /** * @var string */ public $foo; } class Zend_Soap_Wsdl_ComplexTypeA { /** * @var Zend_Soap_Wsdl_ComplexTypeB[] */ public $baz = array(); } 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('Zend_Soap_Service_Server1'); $server->handle();
/** * @return array array */ public function universidad() { $arreglo[] = array("cod_institucion" => '000001', "siglas" => 'UCV', "cod_carrera" => '006'); $arreglo[] = array("cod_institucion" => '000003', "siglas" => 'UNEFA', "cod_carrera" => '008'); //print_r($arreglo); // descomentar junto a: debug1 return $arreglo; } } // $return_philosopher=new educacion(); // descomentar junto a: debug1 // $return_philosopher->universidad(); // descomentar junto a: debug1 /* load framework ZF2 */ set_include_path('/srv/www/io/ZendFramework-2.3.2/library'); require_once 'Zend/Loader/StandardAutoloader.php'; $loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true)); $loader->registerPrefix('Zend', '/srv/www/io/ZendFramework-2.3.2/library'); $loader->register(); /* class autodiscover and Zend\Soap\Server */ if (isset($_GET['wsdl'])) { $server = new Zend\Soap\AutoDiscover(); $server->setServiceName('WebServiceEducacion'); } else { $server = new Zend\Soap\Server(); } $uri = 'http://webservice.io/array/server.php'; //$server->setClass ('educacion'); $server->setClass('pc_SOAP_return_time'); $server->setUri($uri); $server->handle();