CodeIgniter Forums
CodeIgniter Web Services Client - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: CodeIgniter Web Services Client (/thread-57132.html)



CodeIgniter Web Services Client - El Forum - 02-19-2013

[eluser]afirdaus[/eluser]
Im newbie in CI, i want to retrieve xml data from web services weblogic, the server locate to http://services.insw.go.id/web-services/nsw?operation.invoke=getListGA and i wanto to get the XML Response from server, possible do this ??

i make funtion on controllers (resttest.php)

Code:
public function getRest()
{
    $this->rest->initialize(array('server' => 'http://services.insw.go.id'));

    $lartas = $this->rest->get('web-services/nsw',array('operation.invoke' => 'getListGA'),'xml');
    die(var_dump($lartas));
}


sometimes i got error like "array(0) { }" and if i refreshed, i got all HTML view same like i browsed http://services.insw.go.id/web-services/nsw?operation.invoke=getListGA

am i wrong or missing some step ? or any suggestion to change this code ??

NB: I used https://github.com/philsturgeon/codeigniter-restclient

Thanks In Advance


CodeIgniter Web Services Client - El Forum - 02-19-2013

[eluser]afirdaus[/eluser]
hi i change my code, i used NuSoap, and everything ok but how get result with JSON or XML format or another else with good format ?

Code:
require_once(APPPATH.'libraries/nusoap/nusoap'.EXT); //includes nusoap
         // Same as application/libraries/nusoap/nusoap.php
         $n_params = array('operation.invoke' => 'My Name', 'email' => '[email protected]');
         $client = new nusoap_client('http://services.insw.go.id/web-services/nsw');
         $result = $client->call('getListGA');
         echo $result;

i want show the result like this

ID : Result1
ID : Result2

---CUT----