/** * Create the service wrapper for an SCA Component. In the event that the * mapping of the SCA Component methods the base_class and xmldas types are * set to null. * * @param string $class_name Class name */ public function __construct($class_name) { //TODO: get rid of the wsdl filename here SCA::$logger->log("Entering constructor"); SCA::$logger->log("class_name = {$class_name}"); $this->class_name = $class_name; $this->class_instance = SCA::createInstance($class_name); SCA::fillInReferences($this->class_instance); //need an xmldas //want to have the xsds in here. do xmldas only here then do add types. $this->xml_das = SCA_Helper::getXmldas($class_name, ""); SCA::$logger->log("Exiting Constructor"); }
/** * Create the service wrapper for an SCA Component. In the event that the * mapping of the SCA Component methods the base_class and xmldas types are * set to null. * * @param string $class_name Class name */ public function __construct($class_name) { //TODO: get rid of the wsdl filename here SCA::$logger->log("Entering constructor"); SCA::$logger->log("class_name = {$class_name}"); $this->class_name = $class_name; $this->class_instance = SCA::createInstance($class_name); SCA::fillInReferences($this->class_instance); // Get an xmldas to handle the SDOs passing in and // out of the wrapped service. This call creates the das // and adds all of the service types to it. $this->xml_das = SCA_Helper::getXmldas($class_name, ""); SCA::$logger->log("Exiting Constructor"); }
/** * This function can be called directly by a component to * create a dataobject from the namespaces defined in the @types annotations. * * @param string $namespace_uri Namespace identifying the xsd * @param string $type_name Element being reference in the xsd * * @return object Empty Data Object structure */ public static function createDataObject($namespace_uri, $type_name) { // Find out who/what called this function so that the type annotations // that define the xml used to create a 'das' can be scanned. $backtrace = debug_backtrace(); $caller = $backtrace[0]; $filepath = $caller['file']; $keyname = md5(serialize($filepath)); // Check if there is a matching xsd in the xmldas array if (array_key_exists($keyname, self::$xml_das_array)) { $xmldas = self::$xml_das_array[$keyname]; } else { // The trap will only trigger if the Annotations cannot be found // normally this is because a SCA Client Component has incorrectly // attempted to use this method, rather than the 'createDataObject' // method of either the 'Proxy, or LocalProxy. try { $class_name = SCA_Helper::guessClassName($filepath); $xmldas = SCA_Helper::getXmldas($class_name, null); self::$xml_das_array[$keyname] = $xmldas; } catch (ReflectionException $e) { $msg = $e->getMessage(); throw new SCA_RuntimeException("A PHP ReflectionException was thrown with message {$msg}. " . "This is usually the result of calling SCA::createDataObject from a user script. " . "User scripts should only call createDataObject on an SCA Proxy object."); } } return $xmldas->createDataObject($namespace_uri, $type_name); }