Pages

5/31/2012

Google Apps update alerts: Google Apps Password Sync for AD

Google Apps update alerts: New Product: Google Apps Password Sync for Active ...: Google Apps Password Sync allows Google Apps admins to synchronize their users' passwords from Active Directory to Google Apps as they are changed.

Edit: A comment on this, the utility only submit's password changes as they happen on the Active Directory Side, it does not provide a AD attribute that you can use with GADS to sync on a regular basis.  You'll want to use the utility in my other articles if you want it to also sync passwords on a regular basis as a fail-back.

5/21/2012

Blackboard Connect 5 API with PHP

I've been working on connecting our Data Warehouse to the Blackboard Connect Service using the SOAP API's. For those interested, here is the quick and dirty way to do it on PHP 5.3

Create the SOAP client
$client = new SoapClient("https://Service.BlackboardConnect.com/Contact/v2/ContactService.asmx?wsdl",array ('trace' => 1));
Create Authorization Header
//Parameters
  $options = array(
       'DATE' => gmdate("Ymd"),
       'TIME' => gmdate("Hi"), 
       'API' => '*API KEY*',
       'SECRET => '*API SECRET*');

//Hash Parameters
$hash = md5(strtoupper($options['API']) . '|' . $options['SECRET'] . '|' . $options['DATE'] . '|' . $options['TIME']);

//Create Token
$authtoken = trim($hash . '|' . $options['API']);

$headerbody = array('Token' => $authtoken);

//Set SOAP Header
$header = new SOAPHeader('BBConnect.Service.Contact', 'AuthToken', $headerbody);
$client -> __setSoapHeaders($header);
I had to strip the header tag for the xml
$xml = simplexml_load_file(*path to file*);

$convert = $xml->asXML();
$xmldata = str_replace('<?xml version="1.0" encoding="UTF-8"?>', '', $convert);
Create SOAP Variable
$input = new SoapVar( $xmldata, XSD_ANYXML );
 Submit Request
try {   
            $request = new StdClass();
            $request->inputXml = (object) array('any' => $input );
            $response = $client->UpdateContact($request);
        } catch (Exception $e) {
            echo "<h2>Exception Error!</h2>";
            echo $e -> getMessage();
            }

Get Response
echo "<h3>RESPONSE:</h3>";
echo htmlspecialchars($client->__getLastResponse());
Debug Request/Header
echo "<h3>REQUEST:</h3>";
echo htmlspecialchars($client->__getLastRequest());
echo "<h3>REQUEST HEADERS:</h3>";
echo htmlspecialchars($client->__getLastRequestHeaders());
Blackboard Connect 5 API Documentation

Pretty straight forward, if you have any questions let me know.