NuSOAP + PHP, wsdl error: parsing XML errors in WSDL

I'm trying to use nuSOAP to send an array with some data that will use it in the database, but every time I get this "wsdl error: XML error parsing the WSDL problem ... not correctly generated (invalid token)" on my client .php

Here is my little server code:

$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 client code:

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

Has anyone understood why it is not working?

thanks

+4
source share
1 answer

I found what I was doing wrong when I called the client, I didn’t have some arguments ...

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

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

+2
source

Source: https://habr.com/ru/post/1492946/


All Articles