[eluser]ibnclaudius[/eluser]
I have this code to call a Java Web Service, everything work correctly, but I`d like to know if you guys recommend me change something...
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class test_library
{
var $CI;
var $test = array();
public function __construct()
{
$this->CI =& get_instance();
$this->CI->load->config('test_config', TRUE);
$this->test['config'] = $this->CI->config->item('test', 'test_config');
try
{
$this->test['client'] = new SoapClient($this->test['config']['client']['wsdl'], $this->test['config']['client']['options']);
}
catch (Exception $e)
{
log_message('error', $e->getMessage());
$this->test['client'] = NULL;
}
}
public function say_hello($name)
{
if ($this->test['client'])
{
try
{
$params = array('arg0' => $name);
$response = $this->test['client']->sayHello($params)->return;
}
catch (Exception $e)
{
log_message('error', $e->getMessage());
$response = NULL;
}
}
else
{
$response = NULL;
}
return $response;
}
}