2013-07-23 71 views
3

我想使用nuSOAP發送一個數據將使用它在數據庫上的數據,但每次我得到這個「WSDL錯誤:XML錯誤解析WSDL問題......沒有很好地形成(標記無效)」我client.phpNuSOAP + PHP,wsdl錯誤:XML錯誤解析WSDL問題

這裏是我的一點點我的服務器上的代碼:

$server->register('cadastrar', 
array('dados'=>'tns:cadastro'), 
array('return'=>'xsd:string'), 
$namespace, 
$namespace.'#cadastrar', 
'rpc', 
'encoded', 
'' 
); 



$server->wsdl->addComplexType('cadastrar', 'complexType', 'struct', 'all','', 
array(
    'empresa' =>array ('name'=>'empresa','type'=>'xsd:string') 
    ,'nome' =>array ('name'=>'nome','type'=>'xsd:string') 
    ,'email' =>array ('name'=>'email','type'=>'xsd:string') 
    ,'ddd' =>array ('name'=>'ddd','type'=>'xsd:string') 
    ,'tel' =>array ('name'=>'tel','type'=>'xsd:string') 
    ,'msg' =>array ('name'=>'msg','type'=>'xsd:string') 
) 
); 



function cadastrar($dados){ 

//$objCliente = new Cliente(); 
//if($objCliente) 
    //$id = $objCliente->cadastroWebService($dados); 
    return $dados['empresa']; 

} 

,這是我在客戶端代碼:

$dados = array(
    'empresa' => $_POST['empresa'], 
    'nome' => $_POST['nome'], 
    'email' => $_POST['email'], 
    'ddd' => $_POST['ddd'], 
    'tel' => $_POST['tel'], 
    'msg' => $_POST['msg'] 
    ); 

//Chama o metodo call do SOAP 


$result = $client->call('cadastrar', array('cadastro'=> $dados)); 

有人有什麼想法爲什麼不工作?

感謝

回答

2

我發現我在做什麼錯當我iniciating客戶我失去了一些參數...

$client = new nusoap_client('http://www.domain.com/server.php?wsdl&debug=1', 'wsdl'); 

我只是把wsdl&debug=1', 'wsdl'和它的工作它