0
I have a class called Cliente.php connecting to the web service and have another call Requisição.php that generates the XML request and sends to the Cliente.php.
The problem is that the answer I get from the web service I can only show with print_r in class Cliente.php and I can’t show it in class Requisição.php, even putting Cliente with return.
WHAT IT SHOWS IS THE NAME IS: Object Client ( )
class Cliente {
    public function __construct($requisicao) {
        //Endereço e conexão com  o web service
        $client = new SoapClient("http://192.168.1.104:8082/wsdl/FChamada");
        //Requisição ao web service 
        $obj = $client->Requisicao($requisicao);
        //Retorno(Resposta) do web service
        $xml = simplexml_load_string($obj);
        //Retorna o a resposta do web service
        return $xml;  
    }
}
class Requisicao {
    /***********************************************************************
     ********************* REQUISÃO ****************************************
     **********************************************************************/
    public function query() {
        $req = new Requisicao_XML();
        //Gerando o xml requisição
        $requisicao = $req->toXML();
        //Envia o xml requisição para a classe Cliente e recebe o xml resposta
        $xml = new Cliente($requisicao);
        //Deveria mostrar o xml resposta
        print_r($xml)
    }
}
						
Why Return in constructor method?
– gmsantos
I’ve put in another method, and the same thing happens.
– Alysson
It’s a little confusing to me what you want to do and why this class organization...
– gmsantos
Hey guy was bad, the mistake was mine, I took it from the builder and it really worked. Thanks.
– Alysson