twl Posted December 31, 2019 Report Share Posted December 31, 2019 Bom dia e Feliz ano novo para todos !!!Mais um desafio.rsrsrEstou precisando desenvolver uma rotina para consultar o cartão sus do paciente, mas só encontrei exemplos em java/php, alguém aqui jádesenvolveu algo parecido e esteja disposto a colaborar mas como tenho pouco tempo para resolver estou disposto a pagar, pois vai me levar muito tempo.Postei esse código php só para demonstrar como funciona<?phptry {$wsdlUrl = 'https://servicoshm.saude.gov.br/cadsus/CadsusService/v5r0?wsdl';$wsUser = 'CADSUS.CNS.PDQ.PUBLICO';$passWs = 'kUXNmiiii#RDdlOELdoe00966';$soapClientOptions = array('trace' => 1,'cache_wsdl' => WSDL_CACHE_NONE);$client = new SoapClient($wsdlUrl, $soapClientOptions);$xmlheader = '<wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsse:UsernameToken wsu:Id="UsernameToken-F6C95C679D248B6E3F143032021465917"><wsse:Username>' . $wsUser . '</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">' . $passWs . '</wsse:Password></wsse:UsernameToken></wsse:Security>';$header = new SoapHeader('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', 'Security', new \SoapVar($xmlheader, XSD_ANYXML), false);$client->__setSoapHeaders($header);$requestPesquisar = new stdClass();$requestPesquisar->CNESUsuario = new stdClass();$requestPesquisar->CNESUsuario->CNES = '6963447';$requestPesquisar->CNESUsuario->Usuario = 'LEONARDO';$requestPesquisar->CNESUsuario->Senha = '?';$requestPesquisar->FiltroPesquisa = new stdClass();$requestPesquisar->FiltroPesquisa->nomeCompleto = new stdClass();$requestPesquisar->FiltroPesquisa->nomeCompleto->Nome = 'SERGIO ARAUJO CORREIA LIMA';$requestPesquisar->FiltroPesquisa->tipoPesquisa = 'IDENTICA';$requestPesquisar->higienizar = '0';$result = $client->pesquisar($requestPesquisar);if ($result) {echo '<pre>', print_r($result), '</pre>';} else {echo '<h2>Request:</h2>';echo '<pre>', print_r($client->__getLastRequest()), '</pre>';echo '<h2>Header:</h2>';echo '<pre>', print_r($client->__getLastRequestHeaders()), '</pre>';echo '<h2>Response:</h2>';echo '<pre>', print_r($client->__getLastResponse()), '</pre>';}} catch (Exception $e) {echo '<pre>', print_r($e), '<pre>';}?> Quote Link to comment Share on other sites More sharing options...
Francisco Valério Posted February 20, 2023 Report Share Posted February 20, 2023 Olá Novato tudo bem? Estou em precisando implementar esse padrão OASIS também de assinatura de XML você conseguiu algum avanço? Agradeço desde já Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.