2
Hello, everybody.
I’m trying to consume function "pesquisar"
of the CADSUS bus, but I receive as a response the error
"Forced circuit exception";
The code used follows below, using Laravel 5.6 and PHP 7.1:
Route::get('/ws/teste', function () {
try {
$opts = array(
'http' => array(
'user_agent' => 'PHPSoapClient'
)
);
$context = stream_context_create($opts);
$wsdlUrl = 'https://servicoshm.saude.gov.br/cadsus/CadsusService/v5r0?wsdl';
$soapClientOptions = array(
'trace' => 1,
'stream_context' => $context,
'cache_wsdl' => WSDL_CACHE_NONE,
'Username' => 'CADSUS.CNS.PDQ.PUBLICO',
'Password' => 'kUXNmiiii#RDdlOELdoe00966'
);
$client = new SoapClient($wsdlUrl, $soapClientOptions);
$parameters = array(
'CNESUsuario' => array(
'CNES' => '6963447',
'Usuario' => 'LEONARDO',
'Senha' => ''
),
'FiltroPesquisa' => array(
'nomeCompleto' => 'SERGIO ARAUJO CORREIA LIMA',
'tipoPesquisa' => 'IDENTICA'
),
'higienizar' => 0
);
$result = $client->pesquisar($parameters);
print_r($result);
}
catch(\Exception $e) {
echo $e->getMessage();
} });
If anyone knows what might be going on, please help me!
could put the code within the answer, as we cannot rely on links, since they may be canceled in the future
– Um Programador
@A programmer has already entered the code in the answer.
– Andre Ricardo Alves Dos Santos
It worked perfectly! Thank you very much! Only one question came up: sending user data and password via xml header do not know a security flaw? If someone was sniffing the net, they couldn’t capture the packet and visualize?
– Lucas Maia
Lucas Maia, I can’t tell if there’s a security problem, but I don’t think so. and in the technical specification you request to send, in the example of page 13 http://datasus.saude.gov.br/images/teroperability/Especificao%20Tecnica%20para%20Integration%20CADSUS%20V5.pdf
– Andre Ricardo Alves Dos Santos
Opa, @Andrericardoalvesdossantos, thank you again!
– Lucas Maia
complementing: I found that to return the complete data use the operation consult of the web service informing only the letter sus. but the structure has to be exact I will put in the initial answer.
– Andre Ricardo Alves Dos Santos