Welcome Guest, Not a member yet? Register   Sign In
trouble with CI nusoap library.
#1

[eluser]Zandy[/eluser]
Hi! igniters.!
I'm trying to create a webservice with the library nusoap, but I did not quit.
this is my files.

miserv.php
Code:
<?php
class Miserv extends Controller
{
    function __construct() {
        parent::Controller();
        ini_set("soap.wsdl_cache_enabled", "0");
        $this->load->library("nusoap_lib");
    }
    
    function index() { }
    
    function wsdl() {
        if($this->uri->segment(2) == "wsdl") {
            $_SERVER['QUERY_STRING'] = "wsdl";
        } else {
            $_SERVER['QUERY_STRING'] = "";
        }
        
        $rawPost = strcasecmp($_SERVER['REQUEST_METHOD'], 'POST') == 0? (isset($GLOBALS['HTTP_RAW_POST_DATA'])? $GLOBALS['HTTP_RAW_POST_DATA'] : file_get_contents("php://input")) : NULL;
        $server = new soap_server;
        $server->configureWSDL("localhost");
        $server->register("hello");
        $server->service($rawPost);        
    }
    
    function hello() {
        function hello($name) {
            $CI = &get;_instance();
            return 'Hi '.$name;
        }
    }    
}
?>

client.php
Code:
<?php
    require_once("lib/nusoap.php");
    $wsdl="http://localhost/web/index.php/miserv/wsdl";
    $client=new soapclient($wsdl, 'wsdl');
    echo $client->call('hello');
?>

nusoap_lib.php
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Nusoap_lib
{
   function Nusoap_lib()
   {
       require_once(BASEPATH.'libraries/nusoap/nusoap'.EXT);
   }
}
?>

client.php is in another subfolder..

What should I be doing wrong?, Missing something in the code?

greetings.




Theme © iAndrew 2016 - Forum software by © MyBB