예제 #1
0
 /**
  * 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);
 }
예제 #2
0
파일: Proxy.php 프로젝트: psagi/sdo
 /**
  * Here is where we turn the list of positional parameters into a
  * single array of name parameters e.g. 'IBM' into array('ticker'=>'IBM')
  * This is the opposite of what we do in the ServiceWrapper
  *
  * We have to find the names to be given to each parameter
  * which we currently do by creating an SDO document and an SDO within it
  * then assigning the parameters one by one to the properties of the data object
  *
  * There is an inherent assumption that as we iterate through the
  * properties of the object we will get them in the same order as the
  * wsdl, and that this order is in turn the same as the order of the
  * parameters in the call. This relies on the user to put the @param
  * annotations in the right order in the annotations.
  *
  * @param string $method_name Method name
  * @param array  $arguments   Arguments
  *
  * @return mixed
  */
 public function __call($method_name, $arguments)
 {
     SCA::$logger->log("Entering");
     SCA::$logger->log("method name = {$method_name}");
     if (SCA_Helper::wsdlWasGeneratedForAnScaComponent($this->wsdl_file_name)) {
         $return = null;
         $operation_sdo = null;
         /* Break out of the 'call' in the event of an SDO problem               */
         try {
             $operation_sdo = $this->_getSoapOperationSdo($method_name, $arguments);
         } catch (SDO_Exception $sdoe) {
             throw new SCA_RuntimeException($sdoe->getMessage());
         }
         $operation_array = array($operation_sdo);
         $return = $this->_passTheCallToTheSoapClient($method_name, $operation_array);
         return $return[$method_name . 'Return'];
     } else {
         return $this->_passTheCallToTheSoapClient($method_name, $arguments);
     }
 }