Ver Mensaje Individual
  #22 (permalink)  
Antiguo 02/12/2010, 11:18
Avatar de Snaft_J1
Snaft_J1
 
Fecha de Ingreso: diciembre-2006
Mensajes: 285
Antigüedad: 17 años, 5 meses
Puntos: 8
Respuesta: Como puedo ver el header enviado en soap?

o tambien podríamos probar a intentar firmarlo y generar la clave nosotros de forma automatica
Código PHP:
Ver original
  1. <?php
  2. require('soap-wsse.php');
  3. define('CERT_FILE', './certificado.cer');
  4.  
  5. class mySoap extends SoapClient
  6. {
  7.     function __doRequest($request, $location, $saction, $version)
  8.     {
  9.         $doc = new DOMDocument('1.0');
  10.         $doc->loadXML($request);
  11.         $objWSSE = new WSSESoap($doc);
  12.  
  13.         /* Crear el objeto de seguridad, establece y carga la clave */
  14.         /*
  15.         $objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array ('type'=>'public'));
  16.         $objKey->loadKey(CERT_FILE, TRUE, TRUE);
  17.         */
  18.  
  19.         /* Firmamos el mensaje */
  20.  
  21.         $objWSSE->signSoapDoc(null);
  22.  
  23.         /* Agregamos el certificado */
  24.         $token = $objWSSE->addBinaryToken(file_get_contents(CERT_FILE));
  25.         $objWSSE->attachTokentoSig($token);
  26.        
  27.         $objKey = new XMLSecurityKey(XMLSecurityKey::AES256_CBC);
  28.         $objKey->generateSessionKey();
  29.        
  30.         $siteKey = new XMLSecurityKey(XMLSecurityKey::RSA_OAEP_MGF1P, array('type'=>'public'));
  31.         $siteKey->loadKey(CERT_FILE, TRUE, TRUE);
  32.        
  33.         $options = array("KeyInfo" => array("X509SubjectKeyIdentifier" => true));
  34.         $objWSSE->encryptSoapDoc($siteKey, $objKey, $options);
  35.        
  36.         return parent::__doRequest($objWSSE->saveXML(), $location, $saction, $version);
  37.     }
  38. }
  39.  
  40. $wsdl = 'DomOrder.wsdl';
  41.      
  42. // opciones de conexion
  43. $options = array(
  44. 'location'=>'https://www.dominio.com/anacreon/servlet/APIv3',
  45. 'trace' => true,
  46. );  
  47. $sClient = new mySoap($wsdl, $options);
  48. $wrapper= new SoapVar("9300002", XSD_STRING);
  49.  
  50. try {
  51.   $result = $sClient->getDetailsByDomain(new SoapParam("username", "userName"),
  52.                                          new SoapParam("password", "password"),
  53.                                          new SoapParam("reseller", "role"),
  54.                                          new SoapParam("es", "langpref"),
  55.                                          new SoapParam("999999998","parentid"),
  56.                                          new SoapParam("directo.com", "domainName"),
  57.                                          new SoapParam(array("All"),"option"));
  58. } catch (SoapFault $fault) {
  59.   echo '<pre>';
  60.   print_r($fault);
  61.   echo '</pre>';
  62. }
__________________
-= El conocimiento y el saber te hacen un ser libre =-
Ando en busca de conocimiento....