o tambien podríamos probar a intentar firmarlo y generar la clave nosotros de forma automatica
Código PHP:
Ver original<?php
require('soap-wsse.php');
define('CERT_FILE', './certificado.cer');
class mySoap extends SoapClient
{
function __doRequest($request, $location, $saction, $version)
{
$doc = new DOMDocument('1.0');
$doc->loadXML($request);
$objWSSE = new WSSESoap($doc);
/* Crear el objeto de seguridad, establece y carga la clave */
/*
$objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array ('type'=>'public'));
$objKey->loadKey(CERT_FILE, TRUE, TRUE);
*/
/* Firmamos el mensaje */
$objWSSE->signSoapDoc(null);
/* Agregamos el certificado */
$objWSSE->attachTokentoSig($token);
$objKey = new XMLSecurityKey(XMLSecurityKey::AES256_CBC);
$objKey->generateSessionKey();
$siteKey = new XMLSecurityKey
(XMLSecurityKey
::RSA_OAEP_MGF1P, array('type'=>'public')); $siteKey->loadKey(CERT_FILE, TRUE, TRUE);
$options = array("KeyInfo" => array("X509SubjectKeyIdentifier" => true)); $objWSSE->encryptSoapDoc($siteKey, $objKey, $options);
return parent::__doRequest($objWSSE->saveXML(), $location, $saction, $version);
}
}
$wsdl = 'DomOrder.wsdl';
// opciones de conexion
'location'=>'https://www.dominio.com/anacreon/servlet/APIv3',
'trace' => true,
);
$sClient = new mySoap($wsdl, $options);
$wrapper= new SoapVar("9300002", XSD_STRING);
try {
$result = $sClient->getDetailsByDomain(new SoapParam("username", "userName"),
new SoapParam("password", "password"),
new SoapParam("reseller", "role"),
new SoapParam("es", "langpref"),
new SoapParam("999999998","parentid"),
new SoapParam("directo.com", "domainName"),
new SoapParam
(array("All"),"option")); } catch (SoapFault $fault) {
echo '<pre>';
echo '</pre>';
}