public function soapServer($request, $response) {/*{{{*/ $postdata = file_get_contents("php://input"); $function = 'soapServer'; $this->ioLogRecorder->addLog(XDateTime::now()->toString()." service [{$function}] ".$this->ioLogRecorder->format2SimpleLog($postdata)); $configs = ProviderConfigFactory::getProviderAppConfigs(PhoneConference::SPTYPE_HUAWEI, TeleConfProvider::APPTYPE_CONF); $callbackUrl = $configs['callbackUrl']; $server = new SoapServer(null, array('uri' => 'HuaweiConfCallback','location'=>$callbackUrl)); $server->setClass('HuaweiTeleConfApi'); try { $lockName = $this->getLockerName($postdata); $cacher= DAL::get()->getCache(Cacher::CACHETYPE_LOCKER); $locker = LockUtil::factory(LockUtil::LOCK_TYPE_MEMCACHE, array('memcache' => $cacher)); $locker->getLock($lockName); $server->handle(); $locker->releaseLock($lockName); } catch(Exception $ex) { $locker->releaseLock($lockName); } header("HTTP/1.1 202 Accepted"); header("Content-Type: text/xml;charset=UTF-8"); return parent::DIRECT_OUTPUT; }/*}}}*/
public function callback() { $s = new SoapServer(DIR_CONFIG . 'ishopclientws.wsdl'); $s->setClass('qiwiSoap'); $s->handle(); exit; }
/** * Traitement par défaut */ public function processDefault() { // On charge la classe exportée Copix::RequireOnce($this->_exportClassFilename); // Définition du serveur Soap if (isset($this->_wsname)) { $server = new SoapServer(_url('wsserver|default|wsdl', array('wsname' => $this->_wsname))); } else { $server = new SoapServer(_url('wsserver|default|wsdl')); } // Assignation de la classe exportée au serveur $server->setclass($this->_exportClass); // Traitement des appels if ($_SERVER['REQUEST_METHOD'] == 'POST') { $server->handle(); return _arNone(); } else { $res = '<strong>' . _i18n('wsserver.handle.title') . '</strong>'; $res .= '<ul>'; foreach ($server->getFunctions() as $func) { $res .= '<li>' . $func . '</li>'; } $res .= '</ul>'; $res; } $tpl = new CopixTpl(); $tpl->assign('MAIN', $res); return new CopixActionReturn(CopixActionReturn::DISPLAY, $tpl); }
/** * Intercept the soapServer method call in order to handle the call thrue the process method * Return php variables, the soap server will transform it in a soap response */ public function processSoap() { $this->wsdl = new jWSDL($this->request->params['module'], $this->request->params['action']); $this->soapServer = $this->getSoapServer($this->wsdl); $this->soapServer->setclass('jSoapHandler', $this); $this->soapServer->handle($this->request->soapMsg); }
public function processRequest(callable $callback) { $server = new \SoapServer($this->wsdl, array('classmap' => $this->classmap)); $server->setObject($this); $this->callback = $callback; $server->handle(); $this->callback = null; }
/** * Building query * * @param array $params Query params * @return array/boolean */ public function request() { $properties = array('classmap' => array('tns:updateBill' => 'qiwiParam', 'tns:updateBillResponse' => 'qiwiResponse')); $wsdl = MODX_CORE_PATH . 'components/minishop2/custom/payment/lib/qiwi/IShopClientWS.wsdl'; $Soap = new SoapServer($wsdl, $properties); $Soap->setClass('qiwiServer', $this->config['shopId'], $this->config['shopKey'], $this->config['statusPaid']); $Soap->handle(); return true; }
public function openinvoiceAction() { $_mode = $this->_getConfigData('demoMode'); $wsdl = $_mode == 'Y' ? 'https://ca-test.adyen.com/ca/services/OpenInvoiceDetail?wsdl' : 'https://ca-live.adyen.com/ca/services/OpenInvoiceDetail?wsdl'; $server = new SoapServer($wsdl); $server->setClass(self::OPENINVOICE_SOAP_SERVER); $server->addFunction(SOAP_FUNCTIONS_ALL); $server->handle(); exit; }
public function ws() { Load::library('WebService'); $server = new SoapServer(null, array('uri' => 'http://localhost/freekore/test/ws')); // Asignamos la Clase $server->setClass('WebService'); // Atendemos las peticiones $server->handle(); $server->getFunctions(); }
/** * Add your definition route and the name route[optional] * * @Route /service * * * @param \Slim\Http\Request $request * @param \Slim\Http\Response $response * @param \Slim\Route $route */ public function indexAction($request, $response, $route) { $dirClass = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Soap' . DIRECTORY_SEPARATOR . 'wsdl' . DIRECTORY_SEPARATOR . 'service.wsdl'; if (file_exists($dirClass)) { $server = new \SoapServer($dirClass, array('soap_version' => SOAP_1_2)); $server->setClass('Raptor2\\ServiceBundle\\Soap\\Service'); $this->app->contentType(\Raptor\Raptor::APPXML); $server->handle(); } }
public function PanamericanaServer() { $server = new SoapServer("Oris.wsdl"); $server->setClass("Metodos"); try { $server->handle(); } catch (Exception $e) { $server->fault('Sender', $e->getMessage()); } }
/** * @Route("/server", name="server") */ public function serverAction() { $server = new \SoapServer('web/public/hello.wsdl'); $server->setObject($this->get('hello_service')); $response = new Response(); $response->headers->set('Content-Type', 'text/xml; charset=ISO-8859-1'); ob_start(); $server->handle(); $response->setContent(ob_get_clean()); return $response; }
function index() { $wsdl = $this->getViewer('wsdl')->process($this); $wsdlFile = TEMP_FOLDER . '/sapphire-wsdl-' . $this->class; $fh = fopen($wsdlFile, 'w'); fwrite($fh, $wsdl); fclose($fh); $s = new SoapServer($wsdlFile, array('cache_wsdl' => WSDL_CACHE_NONE)); $s->setClass($this->class); $s->handle(); }
function soap_serve($wsdl, $functions) { // create server object $s = new SoapServer($wsdl); // export functions foreach ($functions as $func) { $s->addFunction($func); } // handle the request $s->handle(); }
/** * handle 一个 SoapServer * * Uses: * <code> * Watt_Service_Servicer::handleSoapServer( "Your_Class_Servicer", "demo.wsdl" ); * </code> * * @param string $className * @param mixed $wsdl * @param array $options */ public static function handleSoapServer($className, $wsdl, array $options = array()) { if (!class_exists($className)) { Watt::loadClass($className); } //$server = new SoapServer( null, array('uri' => "http://test-uri/") ); $server = new SoapServer(Watt_Config::getConfigPath() . "wsdl/" . $wsdl); $server->setClass($className); $server->handle(); exit; }
public function serverAction(Request $request) { $baseurl = $request->getScheme() . '://' . $request->getHttpHost() . $request->getBasePath(); $server = new \SoapServer($baseurl . '/APIxml.wsdl'); $server->setObject($this->get('moocsy.api_xml')); $response = new Response(); $response->headers->set('Content-Type', 'text/xml; charset=ISO-8859-1'); ob_start(); $server->handle(); $response->setContent(ob_get_clean()); return $response; }
public function index() { $host = $_SERVER['HTTP_HOST']; $module = MODULE_NAME; $action = ACTION_NAME; $server = ""; $wsdl = ""; $soaparray = array('soap_version' => SOAP_1_2); $server = new \SoapServer(file_get_contents(__DIR__ . '/ws/order.wsdl'), $soaparray); $server->setClass(get_class($this)); $server->handle(); }
public function order() { $host = $_SERVER['HTTP_HOST']; $module = MODULE_NAME; $action = ACTION_NAME; $server = ""; $wsdl = ""; $soaparray = array("uri" => "http://10.155.30.170:8880/ws/order.php?wsdl", 'soap_version' => SOAP_1_2); $soaparray = array("location" => "http://" . $host . "/" . $module . "/" . $action, "uri" => $action . ".html"); $server = new \SoapServer(null, $soaparray); $server->setClass(get_class($this)); $server->handle(); }
/** * @Route("/soap/key") * @Template() */ public function sendKeyAction() { // $server = new \SoapServer($this->container->get('templating.helper.assets')->getUrl('cibsoap/soap/test.wsdl')); $server = new \SoapServer('/var/www/LicenseManager/web/bundles/cibsoap/soap/licenseSoap.wsdl'); // $server = new \SoapServer('C:\wamp\www\LicenseManager\web\bundles\cibsoap\soap\licenseSoapWindows.wsdl'); $server->setObject($this->get('sendKey')); $response = new Response(); $response->headers->set('Content-Type', 'text/xml; charset=utf-8'); ob_start(); $server->handle(); $response->setContent(ob_get_clean()); return $response; }
public function serverAction() { ini_set("soap.wsdl_cache", "0"); ini_set("soap.wsdl_cache_enabled", "0"); ini_set('soap.wsdl_cache_ttl', 0); $filePath = $this->getServiceProvider()->getWsdlPath(); $soap = new \SoapServer($filePath); $soap->setObject($this->getServiceProvider()->getService()); $response = new Response(); $response->headers->set('Content-Type', 'text/xml'); ob_start(); $soap->handle(); $response->setContent(ob_get_clean()); return $response; }
/** * Run webservice * * @param Mage_Api_Controller_Action $controller * @return Mage_Api_Model_Server_Adapter_Soap */ public function run() { $urlModel = Mage::getModel('core/url')->setUseSession(false); if ($this->getController()->getRequest()->getParam('wsdl') !== null) { // Generating wsdl content from template $io = new Varien_Io_File(); $io->open(array('path' => Mage::getModuleDir('etc', 'Mage_Api'))); $wsdlContent = $io->read('wsdl.xml'); $template = Mage::getModel('core/email_template_filter'); $wsdlConfig = new Varien_Object(); $queryParams = $this->getController()->getRequest()->getQuery(); if (isset($queryParams['wsdl'])) { unset($queryParams['wsdl']); } $wsdlConfig->setUrl(htmlspecialchars($urlModel->getUrl('*/*/*', array('_query' => $queryParams)))); $wsdlConfig->setName('Magento'); $wsdlConfig->setHandler($this->getHandler()); $template->setVariables(array('wsdl' => $wsdlConfig)); $this->getController()->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($template->filter($wsdlContent)); } elseif ($this->_extensionLoaded()) { $this->_soap = new SoapServer($urlModel->getUrl('*/*/*', array('wsdl' => 1))); use_soap_error_handler(false); $this->_soap->setClass($this->getHandler()); $this->getController()->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($this->_soap->handle()); } else { $this->fault('0', 'Unable to load Soap extension on the server'); } return $this; }
public function __construct($wsdl, array $options = null) { $xml_security = new XML_Security(); $xml_security->enableExternalLoadOfEntities(); parent::__construct($wsdl, $options); $xml_security->disableExternalLoadOfEntities(); }
/** * Handle * * @param string $calling_component_filename Filename * @param string $service_description Service description * * @return mixed */ public function handle($calling_component_filename, $service_description) { SCA::$logger->log('Entering'); $class_name = SCA_Helper::guessClassName($calling_component_filename); $wsdl_filename = str_replace('.php', '.wsdl', $calling_component_filename); if (!file_exists($wsdl_filename)) { file_put_contents($wsdl_filename, SCA_Bindings_Soap_ServiceDescriptionGenerator::generateDocumentLiteralWrappedWsdl($service_description)); } $handler = new SCA_Bindings_soap_Mapper("SoapServer"); try { SCA::$logger->log("Wsdl Type = {$wsdl_filename}"); $handler->setWSDLTypes($wsdl_filename); } catch (SCA_RuntimeException $wsdlerror) { echo $wsdlerror->exceptionString() . "\n"; } if (SCA_Helper::wsdlWasGeneratedForAnScaComponent($wsdl_filename)) { $options = $service_description->binding_config; $options['typemap'] = $handler->getTypeMap(); $server = new SoapServer($wsdl_filename, $options); } else { $server = new SoapServer($wsdl_filename, $service_description->binding_config); } $class_name = SCA_Helper::guessClassName($calling_component_filename); $service_wrapper = new SCA_Bindings_Soap_Wrapper($class_name, $handler); $server->setObject($service_wrapper); global $HTTP_RAW_POST_DATA; $server->handle($HTTP_RAW_POST_DATA); }
/** * This method gets called once for every SOAP header the \SoapServer received * and afterwards once for the called SOAP operation. * * @param string $method The SOAP header or SOAP operation name * @param array $arguments * * @return mixed */ public function __call($method, $arguments) { if ($this->serviceBinder->isServiceMethod($method)) { // @TODO Add all SoapHeaders in SoapRequest foreach ($this->headers as $name => $value) { if ($this->serviceBinder->isServiceHeader($method, $name)) { $this->soapRequest->getSoapHeaders()->add($this->serviceBinder->processServiceHeader($method, $name, $value)); } } $this->headers = null; $this->soapRequest->attributes->add($this->serviceBinder->processServiceMethodArguments($method, $arguments)); // forward to controller $response = $this->container->get('http_kernel')->handle($this->soapRequest, HttpKernelInterface::SUB_REQUEST, false); $this->setResponse($response); // add response soap headers to soap server foreach ($response->getSoapHeaders() as $header) { $this->soapServer->addSoapHeader($header->toNativeSoapHeader()); } // return operation return value to soap server return $this->serviceBinder->processServiceMethodReturnValue($method, $response->getReturnValue()); } else { // collect request soap headers $this->headers[$method] = $arguments[0]; } }
/** * Execução de Serviço * * Construção de Serviços para determinados elementos do sistema, utilizando * ações nesta controladora para acesso. Esta inicialização deve ser * efetuada somente uma vez por requisição. * * @param string $element Nome do Serviço para Execução * @return null */ protected function _execute($element) { // Desabilitar Layout WSL_Controller_Front::getInstance()->getConfig()->setParam('Layout.enabled', false); // Inicialização $service = new SoapServer(null, array('uri' => 'tns:' . $element . 'Service')); // Configurar Classe $service->setClass('Service_' . $element); // Tratamento de Requisição try { $service->handle(); } catch (Exception $e) { // Tratamento de Erro $service->fault('Server', $e->getMessage()); } }
/** * Try to instantiate Zend_Soap_Server * If schema import error is caught, it will retry in 1 second. * * @throws Zend_Soap_Server_Exception */ protected function _instantiateServer() { $apiConfigCharset = Mage::getStoreConfig('api/config/charset'); $wsdlCacheEnabled = (bool) Mage::getStoreConfig('api/config/wsdl_cache_enabled'); if ($wsdlCacheEnabled) { ini_set('soap.wsdl_cache_enabled', '1'); } else { ini_set('soap.wsdl_cache_enabled', '0'); } $tries = 0; do { $retry = false; try { $this->_soap = new Zend_Soap_Server($this->getWsdlUrl(array("wsdl" => 1)), array('encoding' => $apiConfigCharset)); } catch (SoapFault $e) { if (false !== strpos($e->getMessage(), "can't import schema from 'http://schemas.xmlsoap.org/soap/encoding/'")) { $retry = true; sleep(1); } else { throw $e; } $tries++; } } while ($retry && $tries < 5); use_soap_error_handler(false); $this->_soap->setReturnResponse(true)->setClass($this->getHandler()); }
/** * This method gets called once for every SOAP header the \SoapServer received * and afterwards once for the called SOAP operation. * * @param string $method The SOAP header or SOAP operation name * @param array $arguments * * @return mixed */ public function __call($method, $arguments) { if ($this->serviceBinder->isServiceMethod($method)) { if (!empty($this->headers)) { $firstHeaderName = array_keys($this->headers)[0]; if (count($this->headers) === 1 && substr($firstHeaderName, -6) === 'Header') { // headers are wrapped and returned as stdClass! $this->headers = (array) $this->headers[$firstHeaderName]; } // @TODO Add all SoapHeaders in SoapRequest foreach ($this->headers as $name => $value) { if ($this->serviceBinder->isServiceHeader($method, $name)) { $this->soapRequest->getSoapHeaders()->add($this->serviceBinder->processServiceHeader($method, $name, $value)); } } } $this->headers = null; $this->soapRequest->attributes->add($this->serviceBinder->processServiceMethodArguments($method, $arguments)); // forward to controller $response = $this->container->get('http_kernel')->handle($this->soapRequest, HttpKernelInterface::SUB_REQUEST, false); $contentType = SoapMessage::getContentTypeForVersion($this->webserviceContext->getServiceDefinition()->getOption('version')); $response->headers->add(array('Content-Type' => $contentType)); $this->setResponse($response); // add response soap headers to soap server foreach ($response->getSoapHeaders() as $header) { $this->soapServer->addSoapHeader($header->toNativeSoapHeader()); } // return operation return value to soap server return $this->serviceBinder->processServiceMethodReturnValue($method, $response->getReturnValue()); } else { // collect request soap headers $this->headers[$method] = $arguments[0]; } }
public function handle() { if (!array_key_exists("HTTP_RAW_POST_DATA", $GLOBALS)) { $data = file_get_contents("php://input"); } else { $data = $GLOBALS["HTTP_RAW_POST_DATA"]; } @parent::handle($data); }
/** * Executa os métodos no ambiente de homologação do webservice SOAP */ public function homologacaoAction() { $this->noLayout(); ini_set('soap.wsdl_cache_enabled', '0'); $sWsdl = $this->view->baseUrl('/webservice/wsdlValidations/homologacao/modelo1.wsdl'); $server = new SoapServer($sWsdl, array('soap_version' => SOAP_1_1, 'uri' => $this->view->baseUrl('/webservice/index/homologacao/'), 'trace' => TRUE)); $server->setClass('WebService_Model_Processar'); $server->addFunction('RecepcionarLoteRps'); $server->addFunction('ConsultarSituacaoLoteRps'); $server->addFunction('ConsultarNfsePorRps'); $server->addFunction('ConsultarLoteRps'); $server->addFunction('CancelarNfse'); $server->addFunction('ConsultarNfse'); $server->handle(); }
public function __construct($wsdl, $options) { $this->common = new Common(); $types = $this->getXSDTypes($wsdl); $options['typemap'] = array(); foreach ($types as $type) { array_push($options['typemap'], array('type_name' => $type['name'], 'type_ns' => $type['namespace'], 'from_xml' => 'com\\mikebevz\\xsd2php\\SoapServer::unmarshalRoot', 'to_xml' => 'com\\mikebevz\\xsd2php\\SoapServer::marshalRoot')); } parent::SoapServer($wsdl, $options); }
function showIndex() { ini_set("soap.wsdl_cache_enabled", "0"); $server = new SoapServer(fvSite::$fvConfig->get('path.wsdl')); $server->setClass($this->moduleName . 'Action'); $server->handle(); }