Hi there,
I’m very happy to join this community for the first time. I some good knowledge of php but I’m really new the PHP SOAP. I have a webservice document that has the SOAP structure to pass values to the function and get the response. This is the structure:
POST /WSAutorizaciones/WSAutorizacionLaboratorio.asmx HTTP/1.1
Host: 191.97.91.43
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "https://arsvesa.como/ConsultarAfiliado"
<?xml version="1.0" encoding="utf-8"?>
<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://arsvesa.com/">
<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>
I try to consume the function *ConsultarAfiliado * like this:
$wsdl = “http://189.27.91.43/WSAutorizaciones/WSAutorizacionLaboratorio.asmx?WSDL”;
$client = new SoapClient($wsdl, array(‘trace’ => 1)); // The trace param will show you errors stack
$auth =array('Cedula' => '02109427015', '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();
}
I got his error: *I got this error:
Exception Error! Server was unable to process request. —> Object reference not set to an instance of an object.*
As I’m new to using SOAP would anyone help me to solve that out.
Many thanks