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'));
     }
 }
Ejemplo n.º 2
0
     * @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();
}
Ejemplo n.º 3
0
/***
 * SOAP example - Alejandro Martinez (almarag@gmail.com) 
 * In order to this example works, please host code on your webserver
 * and modify the endpoint Uri on script accordingly. 
 * This is the server part of example. I used Zend\Soap libraries
 * since SoapServer function on PHP doesn't support WSDL generation by itself.
 * AutoDiscover class is a very useful library for WSDL generation.
 * For client side part please refer to client.php script.  
 ***/
require_once "WebService/TestWebService.php";
$loader = (require 'vendor/autoload.php');
use BasicConcepts\SOAP\WebService\TestWebService as WebService;
// Note: You should add the return type on docblock in order to
// AutoDiscover can handle it.
/**
 * @return string
 */
function helloWorld()
{
    $webService = new WebService();
    return $webService->HelloWorld();
}
if (isset($_GET['wsdl'])) {
    $autodiscover = new Zend\Soap\AutoDiscover();
    $autodiscover->addFunction('helloWorld')->setUri('http://localhost:8080/webservicetest/server.php')->setServiceName('TestWebService');
    $autodiscover->handle();
} else {
    $server = new Zend\Soap\Server(null, array('uri' => 'http://localhost:8080/webservicetest/server.php'));
    $server->addFunction('helloWorld');
    $server->handle();
}
Ejemplo n.º 4
0
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();
Ejemplo n.º 5
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();
}