尝试连接到SOAP服务时出错



我试图使用巴西CADSUS服务的"搜索"功能,但我得到了以下错误:

"Forced circuit exception";

就在下面,我有下面的代码,它使用Laravel 5.6和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' => '*****',
'Password' => '*****'
);
$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();
} });

如果有任何帮助,我将不胜感激。提前感谢

来自SOAP响应:

[cvc-minLength-valid: Value '' with length = '0' is not facet-valid with
respect to minLength '1' for type '#AnonType_SenhaCNESUsuarioType'.,
cvc-type.3.1.3: The value '' of element 'ns1:Senha' is not valid

因此,Senha不能是空字符串。

最新更新