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')); } }
* @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(); }