[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!