/** * Start a SOAP connection * * @param string $server The URL of the RQP server that we want to connect to * @return mixed Returns a SoapClient object if connection is successful * or false in the case of a soap fault. */ function rqp_connect($server) { $connection = soap_connect($server . '?wsdl'); if (is_soap_fault($connection)) { return false; } return $connection; }
/** * @desc Constructs a singleton webwork_client. */ function wwassignment_client() { global $CFG; // static associative array containing the real objects, key is classname static $instances = array(); // get classname $class = get_class($this); if (!array_key_exists($class, $instances)) { // does not yet exist, save in array # $this->client = new SoapClient($CFG->wwassignment_rpc_wsdl,'wsdl'); $this->client = soap_connect($CFG->wwassignment_rpc_wsdl); # $err = $this->client->getError(); # if ($err) { # error_log($err); # error_log($CFG->wwassignment_rpc_wsdl); # print_error('construction_error','wwassignment'); # } $this->defaultparams = array(); $this->defaultparams['authenKey'] = $CFG->wwassignment_rpc_key; $this->datacache = array(); $this->mappingcache = array(); $instances[$class] = $this; } foreach (get_class_vars($class) as $var => $value) { $this->{$var} =& $instances[$class]->{$var}; } }