Using nusoap with CI

Derek Jones edited this page Jul 5, 2012 · 7 revisions
Clone this wiki locally

Category:Approaches This is how I used the nusoap client library within CI.

First I download nusoap:

http://sourceforge.net/project/downloading.php?group_id=57663&use_mirror=internap&filename=nusoap-0.7.3.zip&12547277;

I opened the zip file (nusoap-0.7.3.zip) and copied the lib folder to my application/libraries folder.

I renamed the lib folder: [quote]application/libraries/lib[/quote] to [quote]application/libraries/nusoap[/quote]

Now I have a function in my controller called soap_test.

Code:


class MyController extends Controller {
     function test_soap(){
         require_once(APPPATH.'libraries/nusoap/nusoap'.EXT); //includes nusoap
         // Same as application/libraries/nusoap/nusoap.php
         $n_params = array('name' => 'My Name', 'email' => 'my@email.adr');
         $client = new nusoap_client('http://server.com/soap/server.php');
         $result = $client->call('soapMethod', $n_params);
         echo $result;
     }
}