Tak jak w tytule kod wygląda tak:
const BASIC_SOAP_OPTIONS = [
'soap_version'=> SOAP_1_2,
'exceptions' => true,
'trace' => 1
];
try{
$timeout = ini_get('default_socket_timeout');
$soapClient = new SoapClient($this->credentials['wsdl'], self::BASIC_SOAP_OPTIONS);
$soapClient->__setLocation($this->credentials['url']);
$emptyHeader = new SoapHeader('','');
$soapClient->__setSoapHeaders($emptyHeader);
$loginResponse = $soapClient->LogIn(['pUserName' => $this->credentials['login'],
'pUserPassword' => $this->credentials['haslo']]);
die($loginResponse);
} catch(\Exception $e){
$test = $soapClient->__getLastRequest();
return false;
}
Co przekłada się na następujące żądanie (login i hasło oczywiście usunąłem) :
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://tempuri.org/">
<env:Header/>
<env:Body>
<ns1:LogIn>
<ns1:pUserName>Login</ns1:pUserName>
<ns1:pUserPassword>Hasło</ns1:pUserPassword>
</ns1:LogIn></env:Body>
</env:Envelope>
W SOAP UI takie żądanie działa, ale w powyższym kodzie już nie. Wyskakuje błąd z wiadomością :
"Akcja SOAP określona dla wiadomości („”) jest niezgodna z akcją SOAP protokołu HTTP („http://tempuri.org/UZDZ/LogIn”). "
Szczerze mówiąc niewiele mi to mówi. Jakieś pomysły?