На основе wsdl метод ping принимает только 3 параметра.
class Ping {
/** @var BaseMessage */ public $message;
}
class BaseMessage {
/** @var string */ public $CommerceCode;
/** @var string */ public $TerminalCode;
/** @var int */ public $Timeout;
}
Кроме того, вы неправильно установили заголовок авторизации.Правильный способ сделать это:
$wsdl = "https://testing.memoryefactura.com/Memory.FEManager/WebService/CFEService.svc?wsdl";
$opts = [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false
],
'http' => [
'user_agent' => 'PHPSoapClient'
]
];
$params = [
'encoding' => 'UTF-8',
'verifypeer' => false,
'verifyhost' => false,
'soap_version' => SOAP_1_1,
'trace' => 1,
'exceptions' => 1,
'connection_timeout' => 180,
'stream_context' => stream_context_create($opts)
];
try {
$client = new \SoapClient($wsdl, $params);
$nameSpace = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd';
$soapUsername = new \SoapVar(
'XXXXX',
XSD_STRING,
null,
$nameSpace,
null,
$nameSpace
);
$soapPassword = new \SoapVar(
'XXXXX',
XSD_STRING,
null,
$nameSpace,
null,
$nameSpace
);
$auth = new \stdClass();
$auth->Username = $soapUsername;
$auth->Password = $soapPassword;
$soapAuth = new \SoapVar(
$auth,
SOAP_ENC_OBJECT,
null,
$nameSpace,
'UsernameToken',
$nameSpace
);
$token = new \stdClass();
$token->UsernameToken = $soapAuth;
$soapToken = new \SoapVar(
$token,
SOAP_ENC_OBJECT,
null,
$nameSpace,
'UsernameToken',
$nameSpace
);
$security = new \SoapVar(
$soapToken,
SOAP_ENC_OBJECT,
null,
$nameSpace,
'Security',
$nameSpace
);
$header = new \SoapHeader($nameSpace, 'Security', $security, true);
$client->__setSoapHeaders([$header]);
$parameters = array(
'CommerceCode' => 'XXXXX',
'TerminalCode' => 'XXXXX',
'Timeout' => 5000
);
$data = $client->Ping($parameters);
} catch (SoapFault $fault) {
echo "REQUEST:\n" . $client->__getLastRequest();
die("\nFaultcode: " . $fault->faultcode . "\nFaultstring: " . $fault->faultstring);
} catch (Exception $e) {
die($e->getMessage());
}