the following Problem drives me crazy:
I am connected to a SOAP WS with WSDL and p12 certificate. I can call something and get the exception if the method is not correct, or if a Parameter is missing:
"Function ("Test1") is not a valid method for this service"
"SOAP-ERROR: Encoding: object has no 'message' property"
But if everything (I think) is correct, the script stops
try{
$client = new SoapClient(
$soapUrl,
array(
'ssl' => array(
'cert' => $cert_file,
'certpasswd' => $cert_password),
'trace' => 1,
'exceptions' => 0
)
)
);
$uuid = gen_uuid();
$SendValue = array('transaction' => Array('uuid'=>$uuid),
'message' => '-test message-',
'delay' => 0,
throwException => 1,
forceRollback => 0);
echo "<br>";
// var_dump($SendValue);
echo "Test Start - "; // this is printed
$result = $client -> Test($SendValue);
echo " - Test Ende"; // this is not printed anymore and all the below
echo "<br>OK - Request:
" . $client->__getLastRequest(). "!
";
echo "<pre>";
print_r($result);
echo "</pre>";
//-----------------------------------------------------------
echo "<h1>EOF</h1>";
}catch(\Exception $exception)
{
echo "Did not work...";
var_dump($exception);
echo "Request:
" . $client->__getLastRequest() . "
";
echo "Response:
" . $client->__getLastResponse() . "
";
}
echo "this is not printed";
Any suggestions please? Thanks a lot in Advance.
Looks like you placed the trace
option in the wrong place in the configuration array. Rather than
array(
'ssl' => array(
'cert' => $cert_file,
'certpasswd' => $cert_password,
'trace' => 1,
'exceptions' => 0
)
)
it should be
array(
'ssl' => array(
'cert' => $cert_file,
'certpasswd' => $cert_password,
)
'trace' => 1,
'exceptions' => 0
)
An effectively unset trace
option (when it's in the wrong place, the fallback default 0
is used) causes __getLastRequest()
to be unavailable`, so you're probably getting "call to an undefined method error".
The most possible reason you're not seeing this is your runtime php configuration that prevents you from seeing error messages. Refer to PHP's white screen of death to see how you can see the errors.
It can also be that SoapClient
throws a different type of exception instead of \SoapFault
. Change that type to \Exception
and see if you get anything.