Authentication error in WSDL

0

using phptester to test the following code:

<?phptry {
$opts = array(
    'http' => array(
        'user_agent' => 'PHPSoapClient'
    )
);
$context = stream_context_create($opts);

$wsdlUrl = 'http://ws.portaledu.com.br:8051/wsConsultaSQL/MEX?wsdl';
$soapClientOptions = array(
    "login"      => "XxXxXxXx", 
    "password"  => "XxXxXxXxX",
    "stream_context" => $context,
    "cache_wsdl" => WSDL_CACHE_NONE
);

$client = new SoapClient($wsdlUrl, $soapClientOptions);

echo $status =(string) simplexml_load_string($client->RealizarConsultaSQL(['codSentenca'=>'06','codColigada'=>$CODCOLIGADA,'codSistema'=>'S','parameters'=>'CODCOLIGADA='.$CODCOLIGADA.';IDPS='.$IDPS.';CPF='.$CPF.';DTNASCIMENTO='.$DTNASCIMENTO])->RealizarConsultaSQLResult)->Resultado->DESCRICAO;

}
catch(Exception $e) {
    echo $e->getMessage();
}

I get the return:

  

WARNING SoapClient :: SoapClient ( link ): failed to open stream: Connection refused on line number 17

Why do not you authenticate, do I need to release any port other than 8051 to make SOAP requests?

    
asked by anonymous 24.05.2018 / 19:11

1 answer

1

When the content is in an endpoint of a ws, via php the most coherent is to do via CURL ...

<?php
    $runfile = 'http://ws.portaledu.com.br:8051/wsConsultaSQL/MEX?wsdl';

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $runfile);

    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

    $content = curl_exec ($ch);

    curl_close ($ch); 

    echo $content;
    
24.05.2018 / 19:20