[eluser]tylderdurden[/eluser]
Hi there,
I'm trying to implement a generic library that will allow for use of PHP5's built in SoapClient capabilities, but I'm having trouble wrapping my head around it all.
What I want to accomplish
A library that I can load through $this->load->library('soapclient') while having the config stored in the right place in application/config.
This library will load up a WDSL file for web services that will let me use the methods are functions of the object.
What I've tried
I first tried it with the controller (just to see if it could work) with the following code:
Code:
<?php
class Blog extends Controller{
function index()
{
$client = new SoapClient('WSDL_URI');
$params = array(
'clientID' => 3444
);
echo '<pre>';
print_r($client->GetCountries($params));
echo '</pre>';
}
}
?>
PHP just dies at this point with a "PHP has encountered an Access Violation at 010A9A8A". If I use var_dump($client->__getFunctions());, then it has no problems.
I gave up there and tried to create a library,
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Soapclientci {
function __construct()
{
$CI = & get_instance();
$this->client = new SoapClient('WDSL_URI');
$this->clientID = $CI->config->item('clientID');
}
function GetCountries()
{
$params = array(
'clientID' => 3444
);
return $this->client->GetCountries($params);
}
}
?>
Sufficed to say, it didn't work either and I'm just totally lost and confused.
Any help in pointing me to the write place would be greatly appreciated.