Salut à tous,

Je voudrais passer des valeurs pour communiquer à un web service (SOAP) dans le header de SOAP ainsi que le body. Je n'arrive pas à trouver des resultats apres mon essaie, je voudrais consumer la fonction ConsultarAfiliado.

Si quelqu'un m'aiderait à le faire je serais tres reconnaissant.

  1. structure du SOAP

Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <AuthenticationHeader xmlns="https://xxxxxxxx.do/">
      <Cedula>string</Cedula>
      <Password>string</Password>
      <Proveedo>int</Proveedo>
    </AuthenticationHeader>
  </soap:Header>
  <soap:Body>
    <ConsultarAfiliado xmlns="https://arssenasa.gob.do/">
      <TipoDocumento>int</TipoDocumento>
      <NumDocumento>string</NumDocumento>
    </ConsultarAfiliado>
  </soap:Body>
</soap:Envelope>

  • Passer des valuers au header à cedula, password, proveedo et au body

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$wsdl = "http://931.57.41.43/WSAutorizaciones/WSAutorizacionLaboratorio.asmx?WSDL";
$client = new SoapClient($wsdl, array('trace' => 1));  // The trace param will show you errors stack
 
$auth =array('Cedula' => '00109457515', 'Password' => 'dmfvmxm2', 'Proveedo' => '12077');
$header = new SoapHeader('NAMESPACE','AuthenticationHeader',$auth,false);
var_dump($client->__setSoapHeaders($header));
 
// web service input params
$request_param = array('TipoDocumento' => '2', 'NumDocumento' => '021827151');
$responce_param = null;
try {
$responce_param = $client->ConsultarAfiliado($request_param);
 
print_r($responce_param->ConsultarAfiliadoResponse);
} catch (Exception $e) {
echo "<h2>Exception Error!</h2>";
echo $e->getMessage();
}