Вопрос

I'm trying to use nuSOAP to send a array with some data that will be use it on DB, but every time i get this "wsdl error: XML error parsing WSDL issue ... not well-formed (invalid token)" on my client.php

Here is my a little of my code on the server :

$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'];

}

and this is my code on the client :

$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));

Anybody got any idea why isn't working ?

Thanks

Это было полезно?

Решение

I found what i was doing wrong when i was iniciating the client i was missing some arguments...

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

I just put the wsdl&debug=1', 'wsdl' and it work it

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top