diff options
Diffstat (limited to 'framework/Web/Services')
-rw-r--r-- | framework/Web/Services/TSoapService.php | 121 |
1 files changed, 61 insertions, 60 deletions
diff --git a/framework/Web/Services/TSoapService.php b/framework/Web/Services/TSoapService.php index 087b5664..e598d796 100644 --- a/framework/Web/Services/TSoapService.php +++ b/framework/Web/Services/TSoapService.php @@ -287,10 +287,10 @@ class TSoapServer extends TApplicationComponent private $_uri=''; private $_classMap; private $_persistent=false; - private $_wsdlUri='';
-
- private $_requestedMethod;
-
+ private $_wsdlUri=''; + + private $_requestedMethod; + private $_server; /** @@ -321,7 +321,7 @@ class TSoapServer extends TApplicationComponent { Prado::using($provider); $providerClass=($pos=strrpos($provider,'.'))!==false?substr($provider,$pos+1):$provider; - $this->guessMethodCallRequested($providerClass);
+ $this->guessMethodCallRequested($providerClass); $server=$this->createServer(); $server->setClass($providerClass, $this); if($this->_persistent) @@ -330,72 +330,73 @@ class TSoapServer extends TApplicationComponent else $server=$this->createServer(); try - {
+ { $server->handle(); } catch (Exception $e) - {
- if($this->getApplication()->getMode()===TApplicationMode::Debug)
- $this->fault($e->getMessage(), $e->__toString());
- else
+ { + if($this->getApplication()->getMode()===TApplicationMode::Debug) + $this->fault($e->getMessage(), $e->__toString()); + else $this->fault($e->getMessage()); } - }
-
- /**
- * Generate a SOAP fault message.
- * @param string message title
- * @param mixed message details
- * @param string message code, defalt is 'SERVER'.
- * @param string actors
- * @param string message name
- */
- public function fault($title, $details='', $code='SERVER', $actor='', $name='')
- {
- $this->_server->fault($code, $title, $actor, $details, $name);
- }
-
- /**
- * Guess the SOAP method request from the actual SOAP message
- *
- * @param string $class current handler class.
- */
- protected function guessMethodCallRequested($class)
- {
- $namespace = $class.'wsdl';
- $message = file_get_contents("php://input");
- $matches= array();
- if(preg_match('/xmlns:([^=]+)="urn:'.$namespace.'"/', $message, $matches))
- {
- if(preg_match('/<'.$matches[1].':([a-zA-Z_]+[a-zA-Z0-9_]+)/', $message, $method))
- {
- $this->_requestedMethod = $method[1];
- }
- }
- }
-
- /**
- * Soap method guessed from the SOAP message received.
- * @return string soap method request, null if not found.
- */
- public function getRequestedMethod()
- {
- return $this->_requestedMethod;
- } - - /** - * Creates the SoapServer instance.
+ } + + /** + * Generate a SOAP fault message. + * @param string message title + * @param mixed message details + * @param string message code, defalt is 'SERVER'. + * @param string actors + * @param string message name + */ + public function fault($title, $details='', $code='SERVER', $actor='', $name='') + { + Prado::trace('SOAP-Fault '.$code. ' '.$title.' : '.$details, 'System.Web.Services.TSoapService'); + $this->_server->fault($code, $title, $actor, $details, $name); + } + + /** + * Guess the SOAP method request from the actual SOAP message + * + * @param string $class current handler class. + */ + protected function guessMethodCallRequested($class) + { + $namespace = $class.'wsdl'; + $message = file_get_contents("php://input"); + $matches= array(); + if(preg_match('/xmlns:([^=]+)="urn:'.$namespace.'"/', $message, $matches)) + { + if(preg_match('/<'.$matches[1].':([a-zA-Z_]+[a-zA-Z0-9_]+)/', $message, $method)) + { + $this->_requestedMethod = $method[1]; + } + } + } + + /** + * Soap method guessed from the SOAP message received. + * @return string soap method request, null if not found. + */ + public function getRequestedMethod() + { + return $this->_requestedMethod; + } + + /** + * Creates the SoapServer instance. * @return SoapServer */ protected function createServer() - {
- if($this->_server===null)
- {
+ { + if($this->_server===null) + { if($this->getApplication()->getMode()===TApplicationMode::Debug) ini_set("soap.wsdl_cache_enabled",0); - $this->_server = new SoapServer($this->getWsdlUri(),$this->getOptions());
+ $this->_server = new SoapServer($this->getWsdlUri(),$this->getOptions()); } - return $this->_server;
+ return $this->_server; } /** |