Welcome Guest, Not a member yet? Register   Sign In
Problem With nuSoap and CI
#1

[eluser]Unknown[/eluser]
hi guys , im really stucked on nusoap in codeigniter , could anybody help me please ?!
here is my soap server controller :

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class soap_member extends CI_Controller {

    var $nusoap_server;
    var $ns = 'http://khoshmaze.ir/index.php/soap_member';

    public function __construct()
    {
        parent::__construct();

        $this->load->library("Nusoap_lib");
        $this->nusoap_server = new soap_server();
        $this->nusoap_server->configureWSDL("MemberWSDL", $this->ns);
        $this->nusoap_server->wsdl->schemaTargetNamespace = $this->ns;

        $input_array = array ('member_id' => "xsd:integer");
        $return_array = array ("return" => "xsd:string");
        $this->nusoap_server->register(
            'getDeviceList',
            $input_array,
            $return_array,
            "urn:SOAPServerWSDL",
            "urn:".$this->ns."/getDeviceList",
            "rpc", "encoded",
            "Addition Of Two Numbers"
            );
    }
    function getDeviceList($member_id) {
        $CI =& get_instance();
        return 'Member';
    }
    function index()
    {
        $this->nusoap_server->service(file_get_contents("php://input"));
    }
    function webservice()
    {
        if($this->uri->rsegment(3) == "wsdl") {
            $_SERVER['QUERY_STRING'] = "wsdl";
        } else {
            $_SERVER['QUERY_STRING'] = "";
        }
        $this->nusoap_server->service(file_get_contents("php://input"));
    }
}

and here is my soap client controller

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

class Client extends CI_Controller {

var $nusoap_client;
var $ns = 'http://127.0.0.1/samenea/index.php/soap_member?wsdl';
public function __construct()
{
  parent::__construct();
  

  $this->load->library("Nusoap_lib");
}

public function index()
{
  $this->nusoap_client = new SoapClient($this->ns);
  $something =  $this->nusoap_client->getDeviceList(array(2));
  var_dump($something->getDeviceListResult);
}

}

/* End of file client.php */
/* Location: ./application/controllers/client.php */

and i got this error when i call the client :

Quote:Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Client] method 'getDeviceList'('getDeviceList') not defined in service('' '') in /var/www/html/samenea/application/controllers/client.php:18 Stack trace: #0 /var/www/html/samenea/application/controllers/client.php(18): SoapClient->__call('getDeviceList', Array) #1 /var/www/html/samenea/application/controllers/client.php(18): SoapClient->getDeviceList(Array) #2 [internal function]: Client->index() #3 /var/www/html/samenea/system/core/CodeIgniter.php(359): call_user_func_array(Array, Array) #4 /var/www/html/samenea/index.php(202): require_once('/var/www/html/s...') #5 {main} thrown in /var/www/html/samenea/application/controllers/client.php on line 18


thank you guys ..
#2

[eluser]tudo75[/eluser]
Maybe the problem is the wrong $ns values in your Controllers
Code:
class soap_member extends CI_Controller {

    var $nusoap_server;
    var $ns = 'http://khoshmaze.ir/index.php/soap_member';

and

Code:
class Client extends CI_Controller {

var $nusoap_client;
var $ns = 'http://127.0.0.1/samenea/index.php/soap_member?wsdl';




Theme © iAndrew 2016 - Forum software by © MyBB