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'));
     }
 }
Exemplo n.º 2
0
<?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();
}