public static function Run($strClassName, $strNamespace = null)
 {
     QApplication::$EncodingType = 'UTF-8';
     $objWsdlCache = new QCache('soap', QApplication::$ScriptName, 'wsdl', QApplication::$ScriptFilename);
     $objDiscoCache = new QCache('soap', QApplication::$ScriptName, 'disco', QApplication::$ScriptFilename);
     $objClassWrapperCache = new QCache('soap', QApplication::$ScriptName, 'class.php', QApplication::$ScriptFilename);
     // Reflect through this QSoapService
     $strDisco = $objDiscoCache->GetData();
     if ($strDisco === false || !$strNamespace) {
         $objReflection = new ReflectionClass($strClassName);
     }
     // Figure Out Namespace
     if (!$strNamespace) {
         $objReflectionProperties = $objReflection->getStaticProperties();
         $strNamespace = $objReflectionProperties['DefaultNamespace'];
     }
     $strNamespace = trim($strNamespace);
     if (QString::LastCharacter($strNamespace) == '/') {
         $strNamespace = substr($strNamespace, 0, strlen($strNamespace) - 1);
     }
     // Check for Cached Disco
     if ($strDisco === false) {
         // Instantiate Service and Setup new Soap Methods
         $objService = new $strClassName($strClassName, $strNamespace);
         // Setup SOAP Methods
         try {
             $objService->SetupSoapMethods($objReflection);
         } catch (QCallerException $objExc) {
             $objExc->IncrementOffset();
             throw $objExc;
         }
         // Get Disco, Wsdl and Wrapper, and cache them!
         $objWsdlCache->SaveData($objService->GetWsdl());
         $objDiscoCache->SaveData($objService->GetDisco());
         $objClassWrapperCache->SaveData($objService->GetClassWrapper());
     }
     // Process Service Browse (e.g. if accessed via GET)
     if ($_SERVER['REQUEST_METHOD'] == 'GET') {
         if (array_key_exists('QUERY_STRING', $_SERVER)) {
             switch (strtolower($_SERVER['QUERY_STRING'])) {
                 case 'disco':
                     header('Content-Type: text/xml');
                     _p('<?xml version="1.0" encoding="' . QApplication::$EncodingType . '"?>', false);
                     _p($objDiscoCache->GetData(), false);
                     return;
                 case 'wsdl':
                     header('Content-Type: text/xml');
                     _p('<?xml version="1.0" encoding="' . QApplication::$EncodingType . '"?>', false);
                     _p($objWsdlCache->GetData(), false);
                     return;
             }
         }
         printf('<link rel="alternate" type="text/xml" href="%s?disco"/><a href="%s?disco">Web Service Discovery File</a> &nbsp;|&nbsp; <a href="%s?wsdl">Web Service Description File (WSDL)</a>', QApplication::$ScriptName, QApplication::$ScriptName, QApplication::$ScriptName);
         return;
     }
     // Process Service Execution (e.g. accessed via a POST)
     $objService = new $strClassName($strClassName, $strNamespace);
     // Get the Request
     $strRequest = file_get_contents("php://input");
     // Create the Service Class Wrapper
     require $objClassWrapperCache->GetFilePath();
     // Use PHP 5.1+'s SoapServer class to handle the actual work
     $objService->objSoapServer = new SoapServer($objWsdlCache->GetFilePath());
     $objService->objSoapServer->setClass($strClassName . 'Wrapper', $strClassName, $strNamespace);
     $objService->objSoapServer->handle($strRequest);
 }
Exemple #2
0
 QDateTime::$DefaultFormat = QDateTime::FormatIso;
 function t($strText)
 {
     return QApplication::Translate($strText);
 }
 ///////////////////////
 // Setup Error Handling
 ///////////////////////
 if (array_key_exists('SERVER_PROTOCOL', $_SERVER)) {
     set_error_handler('QcodoHandleError', error_reporting());
     set_exception_handler('QcodoHandleException');
 }
 spl_autoload_register(array('QApplication', 'Autoload'));
 QApplication::Initialize();
 QApplication::InitializeDatabaseConnections();
 QApplication::$EncodingType = 'UTF-8';
 NarroUser::GetDatabase()->NonQuery("SET NAMES 'utf8'");
 NarroUser::RegisterPreference('Items per page', 'number', t('How many items are displayed per page'), 10);
 NarroUser::RegisterPreference('Font size', 'option', t('The application font size'), 'medium', array('x-small', 'small', 'medium', 'large', 'x-large'));
 NarroUser::RegisterPreference('Language', 'option', t('The language you are translating to'), QApplication::QueryString('l'), array(QApplication::QueryString('l')));
 NarroUser::RegisterPreference('Application language', 'option', t('The language you want to see Narro in'), isset(QApplication::$TargetLanguage) ? QApplication::$TargetLanguage->LanguageCode : NarroLanguage::SOURCE_LANGUAGE_CODE, array(isset(QApplication::$TargetLanguage) ? QApplication::$TargetLanguage->LanguageCode : NarroLanguage::SOURCE_LANGUAGE_CODE));
 NarroUser::RegisterPreference('Special characters', 'text', t('Characters that are not on your keyboard, separated by spaces'), '$€');
 NarroUser::RegisterPreference('Automatically save translations', 'option', t('Save translations when moving to the next text to translate'), 'No', array('Yes', 'No'));
 NarroUser::RegisterPreference('Launch imports and exports in background', 'option', t('Launch imports and exports in background'), 'Yes', array('Yes', 'No'));
 NarroUser::RegisterPreference('Load more texts while scrolling', 'option', t('Whether to load more content if you reach the bottom of the page'), 'No', array('Yes', 'No'));
 if (!isset($argv)) {
     QApplication::SessionOverride();
     QApplication::InitializeSession();
 }
 QApplication::InitializeUser();
 QApplication::InitializeLanguage();
<?php

require_once '../qcubed.inc.php';
QApplication::$EncodingType = 'ISO-8859-1';
/**
 * Class MyControl
 * A text box to test the setAdditionalPostVar function's abilities, including ability to pass a null value.
 */
class MyControl extends QControl
{
    public $txt;
    public $nullVal;
    public function GetControlHtml()
    {
        return $this->RenderTag('input');
    }
    public function ParsePostData()
    {
        if (isset($_POST[$this->ControlId . '_extra'])) {
            $this->txt = $_POST[$this->ControlId . '_extra']['txt'];
            $this->nullVal = $_POST[$this->ControlId . '_extra']['nullVal'];
        }
    }
    public function Validate()
    {
        return true;
    }
    public function GetEndScript()
    {
        $strId = $this->ControlId;
        $strJs = parent::GetEndScript();