Welcome Guest, Not a member yet? Register   Sign In
help for CI + nusoap
#1

[eluser]ken.sniper[/eluser]
my server code webcom.php
Code:
<?php
class Webcom extends Controller
{
    function __construct()
    {
        parent::Controller();
        $this->load->library("Nusoap_lib");
    }

function index()
{
    function add($para1,$para2)
    {
        if(is_string($para1) && is_string($para2))
            return $para1.$para2;
        if(is_int($para1) && is_int($para2))
            return $para1+$para2;
        else
            return "error para";
    }
        $this->nusoap_server->register('add',
           array('para1'=>'xsd:string','para2'=>'xsd:string'),            array('return'=>'xsd:string'),                                'urn:member');        

      $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
      $this->nusoap_server->service($HTTP_RAW_POST_DATA);
}
}

my client code
Code:
<?php
class Checkwsdl extends Controller
{
    function __construct()
    {
        parent::Controller();
        $this->load->library("Nusoap_lib");
    }




    function addtest()
    {
        $this->nusoap_client = new nusoap_client('http://www.kx1d.com/game/webcom/wsdl','wsdl');    //true
        if($err = $this->nusoap_client->fault)
        {
            echo $err;
            return;
        }
        $this->nusoap_client->soap_defencoding = 'UTF-8';    //2009-5-7
        $this->nusoap_client->decode_utf8 = false;            //2009-5-7
        $this->nusoap_client->xml_encoding = 'utf-8';        
        if($err=$this->nusoap_client->getError())
        {
            print "Error: $err";
            return;
        }
        var_dump($this->nusoap_client);
        $arrypara = array('para1'=>'ken','para2'=>'sniper');
        $result = $this->nusoap_client->call('addEEE',$arrypara);
        echo $result;
    }

}
when i try:'http://localhost/game/webcom
I can get the list of method,like "add"
when i try:'http://localhost/game/checkwsdl/addtest'
I Do not know why, there is no response.
thanks a lot!
#2

[eluser]ken.sniper[/eluser]
Spelling error correction:
Code:
$result = $this->nusoap_client->call('addEEE',$arrypara);
$result = $this->nusoap_client->call('add',$arrypara);
I was wrong, the problem still exists
#3

[eluser]ken.sniper[/eluser]
help~,thanks
#4

[eluser]umefarooq[/eluser]
what kind of error you are getting 404, any
#5

[eluser]ken.sniper[/eluser]
I get nothing,when the client request server.
Code:
$proxy=$client->getProxy();    
var_dump($proxy);
I get the mesthod list,the $proxy is null.
Maybe create client is error
Code:
$this->nusoap_client = new nusoap_client('http://localhost/game/webcom/wsdl','wsdl');




Theme © iAndrew 2016 - Forum software by © MyBB