Example #1
0
 public function soapAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout()->disableLayout();
     $params = $this->getRequest()->getParams();
     if (!isset($params['version'])) {
         $params['version'] = '1.0';
     }
     $service = 'Ged_Service_FileSystem';
     $this->getResponse()->setHeader('Content-Type', 'text/xml;charset=utf-8', true);
     if (isset($params['wsdl'])) {
         $autodiscover = new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
         $autodiscover->setUri(ZendT_Url::getUri());
         $autodiscover->setClass($service);
         $autodiscover->handle();
     } else {
         $version = str_replace('.', '_', $params['version']);
         $names = explode('_', $service);
         $fileWsdl = APPLICATION_PATH . '/modules/' . strtolower($names[0]) . '/' . strtolower($names[1]) . 's/' . $names[2] . '/wsdl/' . $names[2] . '_v' . $version . '.wsdl';
         if (file_exists($fileWsdl)) {
             $wsdl = str_replace("\\", "/", $fileWsdl);
         }
         $server = new Zend_Soap_Server();
         $server->setWsdl($wsdl);
         $server->setClass($service);
         $server->handle();
     }
 }
Example #2
0
 public function soapAction()
 {
     $this->getResponse()->setHeader('Content-Type', 'text/xml;charset=utf-8', true);
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout()->disableLayout();
     $version = $this->getRequest()->getParam('version');
     $wsdl = $this->getRequest()->getParam('wsdl');
     $service = 'Auth_Service_Ldap';
     if ($wsdl) {
         $autodiscover = new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
         $autodiscover->setUri(ZendT_Url::getUri());
         $autodiscover->setClass($service);
         $autodiscover->handle();
     } else {
         if (!$version) {
             $version = '1_0';
         }
         $fileWsdl = APPLICATION_PATH . '/modules/auth/services/Ldap/version_' . $version . '.wsdl';
         if (file_exists($fileWsdl)) {
             $wsdl = str_replace("\\", "/", $fileWsdl);
         } else {
             $wsdl = ZendT_Url::getUri() . '?wsdl=1';
         }
         $server = new Zend_Soap_Server();
         $server->setWsdl($wsdl);
         $server->setClass($service);
         $server->handle();
     }
 }
 public function processWSDL()
 {
     $autodiscover = new Zend_Soap_AutoDiscover(new Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence());
     $autodiscover->setClass('soapserverservice');
     $autodiscover->setUri($this->url('soapserver|soap|Server'));
     $autodiscover->handle();
     return _arNone();
 }
Example #4
0
 public function indexAction()
 {
     if ($this->getRequest()->query->has("wsdl")) {
         $soap = new \Zend_Soap_AutoDiscover("Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex");
         $soap->setUri($this->getRequest()->getUriForPath("/search"))->setClass('\\Server\\CodeSearchBundle\\Libraries\\SoapFacade');
     } else {
         $soap = new \Zend_Soap_Server($this->getRequest()->getUri() . "?wsdl");
         $soap->setObject($this->get('SoapFacade'));
     }
     $response = new Response();
     $response->headers->set('Content-Type', 'text/xml; charset=UTF-8');
     ob_start();
     $soap->handle();
     $response->setContent(ob_get_clean());
     return $response;
 }
Example #5
0
 /**
  * Show the WSDL file of a specific class 
  * 
  * @param string $classname
  */
 public function wsdl($classname)
 {
     //You can add Zend_Auth code here if you do not want
     //everybody can access the WSDL file.
     if (empty($classname)) {
         return false;
     }
     list($app, $module, $class) = explode("_", $classname);
     // initilizing zend autodiscover object.
     $wsdl = new Zend_Soap_AutoDiscover();
     // register SOAP service class
     $wsdl->setClass($classname);
     // set a SOAP action URI. here, SOAP action is 'soap' as defined above.
     $wsdl->setUri("http://" . $_SERVER['HTTP_HOST'] . "/" . strtolower($class) . ".soap");
     // handle request
     $wsdl->handle();
 }
Example #6
0
 public function soapAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout()->disableLayout();
     $params = $this->getRequest()->getParams();
     $service = 'ZendT_Mail_Service';
     $this->getResponse()->setHeader('Content-Type', 'text/xml;charset=utf-8', true);
     if (isset($params['wsdl'])) {
         $autodiscover = new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
         $autodiscover->setUri(ZendT_Url::getUri());
         $autodiscover->setClass($service);
         $autodiscover->handle();
     } else {
         $server = new Zend_Soap_Server();
         #$wsdl = ZendT_Url::getUri() . "?wsdl";
         $wsdl = APPLICATION_PATH . '/controllers/Mail_v1.wsdl';
         $server->setWsdl($wsdl);
         $server->setClass($service);
         $server->handle();
     }
 }
Example #7
0
 /**
  * @group ZF-5736
  */
 public function testAmpersandInUrlIsCorrectlyEncoded()
 {
     $autodiscover = new Zend_Soap_AutoDiscover();
     $autodiscover->setUri("http://example.com/?a=b&b=c");
     $autodiscover->setClass("Zend_Soap_AutoDiscover_Test");
     $wsdl = $autodiscover->toXml();
     $this->assertContains("http://example.com/?a=b&b=c", $wsdl);
 }
Example #8
0
<?php

/**
 * index file
 *
 * PHP Version 5.3.0
 *
 * @category  PHP
 * @package   wsportfolio
 * @author    Sergio Alejandro Valencia Lopez
 * @license   http://www.opensource.org/licenses/bsd-license.php  BSD License
 * @version   SVN: $Id$
 *
 */
require_once 'class/Conf/Autoload.php';
Autoload::register(array(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'Request', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'Response', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'Params', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'Conf', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'Business'));
if (isset($_GET['wsdl'])) {
    include_once 'Zend/Soap/AutoDiscover.php';
    $autodiscover = new Zend_Soap_AutoDiscover(true);
    $autodiscover->setUri('http://127.0.0.1/webservice/index.php');
    $autodiscover->setClass('WebService');
    $autodiscover->handle();
} else {
    ini_set("soap.wsdl_cache_enabled", 0);
    $server = new SoapServer('wsdl/webservice.wsdl');
    $server->setClass('WebService');
    $server->setPersistence(SOAP_PERSISTENCE_SESSION);
    $server->handle();
}
 public function channelAction()
 {
     $this->enforceSecurity();
     $params = Zend_Registry::get('params');
     if (isset($_GET['wsdl'])) {
         $autoDiscover = new Zend_Soap_AutoDiscover();
         $autoDiscover->setUri($params->homelet->domain . '/soap/channel');
         $autoDiscover->setClass('Service_Core_ChannelAccessor');
         $autoDiscover->handle();
     } else {
         // Disable all layouts
         $this->getHelper('viewRenderer')->setNoRender(true);
         // initialize server and set URI
         $server = new Zend_Soap_Server(null, array('uri' => $params->homelet->domain . '/soap/channel'));
         // set SOAP service class
         $server->setClass('Service_Core_ChannelAccessor');
         // handle request
         $server->handle();
     }
 }
Example #10
0
 /**
  * Usluga Zipcodes
  *
  * @return void
  */
 public function zipcodesAction()
 {
     $http = new Zend_Controller_Request_Http();
     $host = ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $http->getServer('HTTP_HOST') . '/ws/zipcodes';
     if (isset($_GET['wsdl'])) {
         $wsdl = new Zend_Soap_AutoDiscover();
         $wsdl->setUri($host)->setClass('Logic_WebService_Zipcode')->handle();
     } else {
         $server = new Logic_Soap_Sms_Server($host . '?wsdl');
         $server->setClass('Logic_WebService_Zipcode');
         $server->handle();
     }
 }
Example #11
0
 /**
  * Run Zend SOAP server
  * @global <type> $CFG
  * @global <type> $USER
  */
 public function run()
 {
     $enable = $this->get_enable();
     if (empty($enable)) {
         die;
     }
     global $CFG;
     include "Zend/Loader.php";
     Zend_Loader::registerAutoload();
     // retrieve the token from the url
     // if the token doesn't exist, set a class containing only get_token()
     $token = optional_param('token', null, PARAM_ALPHANUM);
     ///this is a hack, because there is a bug in Zend framework (http://framework.zend.com/issues/browse/ZF-5736)
     if (empty($token)) {
         $relativepath = get_file_argument();
         $args = explode('/', trim($relativepath, '/'));
         if (count($args) == 2) {
             $token = (int) $args[0];
             $classpath = $args[1];
         }
     }
     if (empty($token)) {
         if (isset($_GET['wsdl'])) {
             $autodiscover = new Zend_Soap_AutoDiscover();
             /*
                             $autodiscover->setComplexTypeStrategy('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
                             $autodiscover->setOperationBodyStyle(
                                 array('use' => 'literal',
                                       'namespace' => $CFG->wwwroot)
                             );
                            
                             $autodiscover->setBindingStyle(
                                 array('style' => 'rpc')
                             );
             */
             $autodiscover->setClass('ws_authentication');
             $autodiscover->handle();
         } else {
             $soap = new Zend_Soap_Server($CFG->wwwroot . "/webservice/soap/server.php?wsdl");
             // this current file here
             $soap->registerFaultException('moodle_exception');
             $soap->setClass('ws_authentication');
             $soap->handle();
         }
     } else {
         // if token exist, do the authentication here
         /// TODO: following function will need to be modified
         $user = webservice_lib::mock_check_token($token);
         if (empty($user)) {
             throw new moodle_exception('wrongidentification');
         } else {
             /// TODO: probably change this
             global $USER;
             $USER = $user;
         }
         //retrieve the api name
         if (empty($classpath)) {
             $classpath = optional_param('classpath', null, PARAM_ALPHANUM);
         }
         require_once dirname(__FILE__) . '/../../' . $classpath . '/external.php';
         /// run the server
         if (isset($_GET['wsdl'])) {
             $autodiscover = new Zend_Soap_AutoDiscover();
             //this is a hack, because there is a bug in Zend framework (http://framework.zend.com/issues/browse/ZF-5736)
             $autodiscover->setUri($CFG->wwwroot . "/webservice/soap/server.php/" . $token . "/" . $classpath);
             $autodiscover->setClass($classpath . "_external");
             $autodiscover->handle();
         } else {
             $soap = new Zend_Soap_Server($CFG->wwwroot . "/webservice/soap/server.php?token=" . $token . "&classpath=" . $classpath . "&wsdl");
             // this current file here
             $soap->setClass($classpath . "_external");
             $soap->registerFaultException('moodle_exception');
             $soap->handle();
         }
     }
 }
Example #12
0
<?php

// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application'));
// Define application environment
defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path())));
include "Zend/Loader/Autoloader.php";
$l = Zend_Loader_Autoloader::getInstance();
include "App/Webservice/Calls.php";
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$application->bootstrap();
if (isset($_GET['WSDL'])) {
    $autodiscover = new \Boilerplate\Webservice\Soap\AutoDiscover();
    $autodiscover->setUri('http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/ws/soap.php');
    $autodiscover->setClass("\\App\\Webservice\\Calls");
    $autodiscover->handle();
} elseif (isset($_GET['INTERNALWSDL'])) {
    $autodiscover = new Zend_Soap_AutoDiscover();
    $autodiscover->setClass('\\App\\Webservice\\Calls');
    $autodiscover->setUri('http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/ws/soap.php');
    $autodiscover->handle();
} else {
    $options = array('soap_version' => SOAP_1_2);
    $server = new \Boilerplate\Webservice\Soap\Server('http://' . $_SERVER['SERVER_NAME'] . '/ws/soap.php?INTERNALWSDL=1', $options);
    $server->setObject(new \App\Webservice\Calls());
    $server->handle();
}