CodeIgniter Forums

Full Version: Easy way to use nusoap with CI
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

So, I had to make soap server in CI and it wasn't easy for me, but at last i did it Smile.
I couldn't find any easy ways to do this on this forum so I decided to share my experience.

first of all you should download the attached zip and unpack it in your libraries folder. there is nusoap directory and nusoap_lib.php.

second step: create controller for example soap_member.php and paste this code in it:

class Soap_Member extends Controller {
    var $nusoap_server;
    var $ns = "http://localhost/index.php/soap_member/"; //this is namespace
    function Soap_Member()
        $this->nusoap_server = new soap_server();
        $this->nusoap_server->configureWSDL("MemberWSDL", $this->ns);
        $this->nusoap_server->wsdl->ports = array('MemberWSDLPort'=> array(
                                                                              "binding"  => "MemberWSDLBinding",
                                                                              "location" => $this->ns,
                                                                              "bindingType"=> ""
            array('member_id' => 'xsd:integer'),
            "Get Member"

        function getMember($member_id) {
            $CI =& get_instance();
            //you can access any of your models like this $CI->member_model->function_name();
            return 'Member';
    function index()
    function webservice()
        if($this->uri->rsegment(3) == "wsdl") {
                $_SERVER['QUERY_STRING'] = "wsdl";
            } else {
                $_SERVER['QUERY_STRING'] = "";

now you can see your wsdl on the same link in your $ns and test your soap server from here or from any soap client.

El Forum

Could you show the clinet code of this soap_server.thank you very much.

El Forum

thank god for a soap library that works!

can you make a simple soap client example of connecting to an external soap server with xml parsing?

best regards,