I am studying the use of SOAP in PHP, and I have a webservice that when I send the number of an employee's registration it returns the employee's name and the sector, but I would like to send 5 registration numbers to the same one time and return the name of 5 employees, how can I adapt my current code that sends only one number at a time?
My code:
<?php
$params = array("soap_version"=> SOAP_1_2,
"trace"=>1,
"exceptions"=>0,
);
$client = @new SoapClient('http://webserviceteste.com.br/WebService/WebService.asmx?WSDL',$params);
$retval = $client->ObterCadastro_S(
array(
'matricula' => '0000',
'inscricao' => '0000',
)
);
echo $retval->ObterCadastro_SResult->NomeFuncionario;
echo $retval->ObterCadastro_SResult->SetorFuncionario;
?>
3-parameter array code
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Documento sem título</title>
</head>
<body>
<?php
//array que guarda 'matricula' => 'inscricao'
//'0001' => '1234',
$arrayMatriculasInscricoes = array("dados" => array("matricula" => 0001, "inscricao" => 1234, "cpf" => 123456789));
echo $arr["dados"]["matricula"];
echo $arr["dados"]["inscricao"];
echo $arr["dados"]["cpf"];
foreach ($arrayMatriculasInscricoes as $i => $inscricao) {
//faz a consulta
$retval = $client->ObterCadastro_S(
array(
'matricula' => $i,
'inscricao' => $inscricao
)
);
echo $retval->ObterCadastro_SResult->NomeFuncionario;
echo $retval->ObterCadastro_SResult->SetorFuncionario;
}
?>
</body>
</html>
Valew