Tema: SoapVar
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/08/2010, 10:37
felcorp
 
Fecha de Ingreso: agosto-2010
Mensajes: 4
Antigüedad: 13 años, 8 meses
Puntos: 0
SoapVar

Disculpen estoy trabajando con el site builder de parallels, necesito crear un usuario con el siguiente codigo:
<?php
/**
* Extended SOAP client for simplified setup of credentials header
*
* @package Utils
* @copyright (c) 2004-2008, Parallels
*/
class Utils_SoapClient extends SoapClient {
protected $_targetNamespace;

/**
* Constructor
*
* @param mixed $wsdl
* @param array $options
*/
public function __construct($wsdl, $options){
parent::__construct($wsdl, $options);
// detect target namespace $xml =
simplexml_load_file($wsdl);
$this->_targetNamespace = (string)
$xml['targetNamespace'];
}

/**
* Set credentials header
*
* @param string $login
* @param string $password
*/
public function setCredentialsHeader($login, $password) {
$header = new SoapHeader($this->_targetNamespace,
'CredentialsSoapHeader',
new SoapVar(
array(
'Login' => $login,
'Password' => $password,
),
SOAP_ENC_OBJECT,
'CredentialsSoapHeader',
$this->_targetNamespace
)
);

$this->__setSoapHeaders(array($header));
}

}
$serviceUrl = 'http://example.com/ServiceFacade/4.5/';
$serviceLogin = 'serviceLogin';
$servicePassword = 'servicePassword';
$accountService = new
Utils_SoapClient($serviceUrl.'/AccountWebService.asmx?WSDL', array());
$accountService->setCredentialsHeader($serviceLogin,
$servicePassword);
$struct = new stdClass();
$struct->username = 'myUserName';
$struct->password = 'myPassword';
$struct->firstName = 'myFirstName';
$struct->lastName = 'myLastName';
$struct->email = '[email protected]';
$struct->role = 'Reseller';
$struct->planId = 1;

$result = $accountService->CreateAccount(new SoapVar($struct,
SOAP_ENC_OBJECT));
$accountId = $result->UserAccount->AccountId;
?>

//++++++++++++++++++++++++++++++++++++

Ya descargue la libreria nusoap donde viene la clase soapclient y soapheader, pero no viene la clase SoapVar, me podrian ayudar donde la puedo encontar por favor, y el metodo CreateAccount como lo llamo si en el código no viene.

Espero una respuesta, d eantemano gracias.