Extensis Logo SUPPORT | FORUMS | KNOWLEDGE BASE

Extensis Portfolio API - FAQ : [ PHP ]


#1

:nerd: Yes !

<?php

//-----------------------------------------------
 
 define("SERVER_ADDRESS","localhost"); 
 define("SERVER_PORT","8090");
 define("USERNAME","administrator");
 define("PASSWORD","password");
  
//-----------------------------------------------

$defaultWsdl = 'http://'.SERVER_ADDRESS.':'.SERVER_PORT.'/ws/1.0/AssetService?wsdl';
$wsdl = (!empty($_SERVER['WSDL'])) ? $_SERVER['WSDL'] : $defaultWsdl;
$client = new SoapClient($wsdl);

ini_set('include_path', './lib');
include('Crypt/RSA.php');

$response = $client->getRSAPublicEncryptionKey();
$rsaInfo = $response->return;
$rsa = new Crypt_RSA();
$rsa->loadKey(array(
  'e' => new Math_BigInteger($rsaInfo->exponent),
  'n' => new Math_BigInteger($rsaInfo->modulusBase16, 16)
));
$password = PASSWORD;
openssl_public_encrypt($password, $encyptedBits, $rsa);
$encryptedPassword = base64_encode($encyptedBits);

$username = USERNAME;
$response = $client->login(array(
  'userName'            => $username,
  'encryptedPassword'   => $encryptedPassword)
);
$sessionId = $response->return;

echo "\n\n" . "Session ID = " . $sessionId ."\n\n\n";

$response = $client->getCatalogs(array(
  'sessionId' => $sessionId
));
$catalogs = $response->return;

print_r($catalogs);

$logout = new stdClass();
$logout->sessionId = $sessionId;
$client->logout($logout);

?>

portfolio_login.zip (64.7 KB)