Application Delivery Management
Application Modernization & Connectivity
IT Operations Management
CyberRes
$stub_prov->getVersion()
or $stub_prov->getAllProvisioningRequests( $user_dn )
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<?php
// specify provisioning WSDL location
$wsdl_prov = "http://172.17.2.91:8180/IDMProv/provisioning/service?wsdl";
// specify provisioning admin
$idm_user = "cn=uaadmin,ou=sa,o=data";
$idm_pwd = "secret";
// declare generic error handler
set_error_handler( 'error_handler' );
set_exception_handler('exception_handler');
// show message with current time stamp
date_default_timezone_set( 'Europe/Paris' );
function echo_time( $msg )
{
$now = localtime( );
echo "$now[2]:$now[1]:$now[0] - ", $msg, "<br>";
}
// generic error handling
function error_handler($errno, $error, $file, $line) {
echo_time( "<font color=red><b>Error: </b> [$errno]: [$file:$line]: $error</font><br>" );
}
// generic exception handling
function exception_handler( $exception ) {
echo_time( "<font color=red><b>Exception: </b>" . $exception->getMessage() . "</font><br>" );
}
// initialize/get IDM SOAP stub with html header
function getSoapStub( $wsdl, $user, $pwd )
{
echo_time( "getSoapStub( $wsdl ) for $user .. ", $wsdl );
$stub = null;
try
{
$stub = @new SoapClient( $wsdl,
array( 'login' => $user,
'password' => $pwd ) );
echo_time( "getSoapStub() - OK" );
}
catch ( SoapFault $exception )
{
exception_handler( $exception );
}
return( $stub );
}
// ##########################################################################################################
echo_time( "Start .. <br>" );
try
{
$stub_prov = getSoapStub( $wsdl_prov, $idm_user, $idm_pwd );
if ( $stub_prov != null )
{
// -----------------------------------------------------------------------------------
// 1st SOAP call: get server stub version
echo "<hr>";
echo_time( "stub_prov->getVersion()" );
$version = $stub_prov->getVersion();
// dump result
echo( "var_export version = " . print_r( $version, TRUE ) );
echo "<br>";
if ( $version != null )
{
echo_time( "version->Version->major = " . $version->Version->major );
echo_time( "version->Version->minor = " . $version->Version->minor );
echo_time( "version->Version->revision = " . $version->Version->revision );
}
else
{
echo_time( "version = " . $version );
}
// -----------------------------------------------------------------------------------
// 2nd SOAP call: get all available requests for specified user
echo "<hr>";
echo_time( "stub_prov->getAllProvisioningRequests( $idm_user )" );
$provReqArray = $stub_prov->getAllProvisioningRequests( $idm_user );
// dump result
echo( "<pre>" );
echo( print_r( $provReqArray, TRUE ) );
echo( "</pre>" );
echo "<hr>";
echo( "<pre>" );
echo print_r( $provReqArray->result->provisioningrequest, TRUE );
echo( "</pre>" );
echo "<hr>";
// -----------------------------------------------------------------------------------
echo "<hr>";
}
}
catch ( Exception $exception )
{
exception_handler( $exception );
}
echo_time( "... end " );
?>
</body>
</html>