• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Nusoap in Code Igniter 1.5.4

Ok, solved.

I didn't put the "wsdl" parameter. So I put it.

Now it is like this:

$this->nusoap_client = new soapclient("http://radiovazogasy.com/wsdl/?wsdl", "wsdl");

and it works.

Hi there,

I've been struggling with getting NuSOAP integrated with CI in the way I would like.

I have got it working as described on the full example with Xajax (not using the Xajax part) but this is going to break the .NET clients that connect to me I think.

The way I have used NuSOAP before is to define/register all my functions and complex types in one script like so.

$server = new nusoap_server;
$NAMESPACE = 'http://my.namespace.com/';
$server->wsdl->schemaTargetNamespace = 'http://my.namespace.com/server_xsd/';

    //snip for brevity

    //snip for brevity

    array('return'=>'tns: MyType1'),$NAMESPACE);


function MyFunction1($id)
    $row["name"] = "test";
    return $row;

function MyFunction2($id)
    $row["name2"] = "test2";
    return $row;


//End Server
Then, in the client, in code (using NuSOAP) I would do:
$client = new nusoapclient("http://my.domain.com/server.php?wsdl",'wsdl');
$result = $client->call("MyFunction1", 123);

//End Client

This is similar to the way it get's called in .NET also. However, with the method described in the tutorial, It seems I cannot use the wsdl and need to point the client code to the individual functions defined on the server - which have been wrapped up in a nested function. What this means for the .NET clients is they will have to point to the wsdl for each function I have defined on my server - .NET provides a utility which generates all the C# stub code so this would generate a file for each function whereas before they just point to the server, it generates one file with all info in that file which they then import into their project. So all they require is the URL of the WSDL and it takes care of everything else, where as in this method they need to know they function names of the wrapper functions in CI. (At least thats my understanding of it so far but please point me in the right direction if im wrong here)

Is there anyway to get NuSOAP working with CodeIgniter as described above?


[eluser]Myles Wakeham[/eluser]
Digging up an old thread, but I'm in the same boat as Martin... I have multiple functions in my SOAP web services that are exposed and end users that run tools (in my case Delphi 2010) that consume these services through a 'WSDL Importer' that creates all the stub code automatically for them from the WSDL. These tools expect one WSDL to be available for ALL functions rather than individual WSDL URLs for each function.

If anyone has found a way to have one common WSDL URL that covers all functions and allows these external tools to work in harmony with the code, please post the solution.


What I did to get it working was declare all the functions inside the index() function.


class Soapy extends Controller

    function Soapy()

        $this->nusoap_server = new nusoap_server();
        $this->namespace = "www.example.com";
           $this->nusoap_server->wsdl->schemaTargetNamespace = "http://example.com/Soapy_xsd/";

            array('username'=>'xsd:string', 'password' => 'xsd:string'),

    function index()
        if($this->uri->segment(3) == "wsdl")
            $_SERVER['QUERY_STRING'] = "wsdl";
            $_SERVER['QUERY_STRING'] = "";

        function Test($id)
            return "Test Worked: $id";
         * This get's called at the beginning of a session.
        function Login($username, $password)
            $CI =& get_instance();
            // do your login whatever


Then if you client has code generation from the WSDL type stuff you can do:
E.g. (with Python)

wsdl2py --url=http://www.example.tv/soap/soapy/wsdl

And then in the file it creates, you need to remove the "/wsdl" from the wsdl URL that it will generate. I hope that makes sense. I have tried this from Python and .NET and it works. This is what I had to do anyway becuase I dont allow ? query params which Nusoap expects.

I can't remember if I had to patch NuSoap to get around the ? problem. Feel free to PM me if that doesnt work and I will send you my nusoap.php file and a link to a live site.


[eluser]Myles Wakeham[/eluser]
Interesting... Do you create any routes in routes.php in your Config to work with this?


$route['soap/soapy/wsdl'] = 'soap/soapy/index/wsdl';

Hope that helps

A good example of how to use nuSoap to connect to a .NET blog is explained here:

http://free biesms.blogspot.com/2009/01/send-free-sms-from-php.html

$useCURL = isset($_POST['usecurl']) ? $_POST['usecurl'] : '0';
$client = new soapclient('http://www.freebiesms.co.uk/sendsms.asmx?WSDL', 'wsdl');

After a hard time trying to figure out how I can apply NuSOAP library in version 1.5.4 a solution occurred to me that I share with all of you who came across the same problem.

hi all,
first thanks for such a nice discussion here
i have a question, why it is not possible to use database functions in server function (at least i can't)
whenever i use $this->db->query("select * from table") it generate an error, but it is ok to use native php mysql functions or using CI models

thanx in advance

Please open a new thread about your problem. Your issue is clearly not connected to this thread. As for your problem, it seems to me that you havent loaded database but its hard to say without the error you get. So please start a new thread and add more information about the problem(error you get, piece of actual code and tell if that code is in library or controller or what).

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

Users browsing this thread:
1 Guest(s)

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.