<?php // This code depends on the PHP Soap and PHP OpenSSL modules being available // // There appears to be a bug in PHP Soap that // incorrectly wraps WS-I compliant Arrays in // an object that carries the name of the // object type of the elements in the array. // This seems to occur only when SOAP_SINGLE_ELEMENT_ARRAYS // is enabled, but disabling it is not really an option // because that deserializes single element arrays into non-array properties. $username = "kelvin"; $password = "fahrenheit"; // Set up the client $client = new SoapClient('https://services.companywebcast.com/management/2.0/ManagementService.svc?wsdl', array('features' => SOAP_SINGLE_ELEMENT_ARRAYS)); // CustomerList Method // retrieves the list of customers for which the user is authorized $CustomerListParameters = new stdClass(); $CustomerListParameters->Username = $username; $CustomerListParameters->Password = $password; $CustomerListParameters->PageNumber = 0; $CustomerListParameters->PageSize = 100; // Call the CustomerList Method on the ManagementService $CustomerListResponse = $client->CustomerList($CustomerListParameters); // CustomerListResult contains an integer // that indicates the success or failure of your request $CustomerListResult = $CustomerListResponse->CustomerListResult; // CustomerSummaries contains a collection of CustomerSummary $CustomerSummaries = $CustomerListResponse->CustomerSummaries; if ( $CustomerListResult == 0 && property_exists($CustomerSummaries, "CustomerSummary") && count($CustomerSummaries->CustomerSummary) > 0) { // CustomerList was successful and we have access to 1 or more customers $Customers = $CustomerSummaries->CustomerSummary; // CustomerGet Method // retrieves a customer $CustomerGetParameters = new stdClass(); $CustomerGetParameters->Username = $username; $CustomerGetParameters->Password = $password; $CustomerGetParameters->CustomerCode = $Customers[0]->Code; // Call the CustomerGet method $CustomerGetResponse = $client->CustomerGet($CustomerGetParameters); // ProfileListResult contains an integer // that indicates the success or failure of your request $CustomerGetResult = $CustomerGetResponse->CustomerGetResult; if ($CustomerGetResult == 0) { // CustomerGet was succesful // We retrieved a Customer // Customer contains information about a customer, such as a list of // Profiles and Modules this Customer has access to. $Customer = $CustomerGetResponse->Customer; // WebcastCreate Method // creates a new Webcast based on a Profile $WebcastCreateParameters = new stdClass(); $WebcastCreateParameters->Username = $username; $WebcastCreateParameters->Password = $password; $WebcastCreateParameters->CustomerCode = $Customer->Code; $WebcastCreateParameters->ProfileId = $Customer->Profiles->Profile[0]->Id; $WebcastCreateParameters->ScheduledStart = "2012-12-29T12:12:28Z"; // Call the WebcastCreate Method $WebcastCreateResponse = $client->WebcastCreate($WebcastCreateParameters); // WebcastCreateResult contains an integer // that indicates the success or failure of your request $WebcastCreateResult = $WebcastCreateResponse->WebcastCreateResult; // WebcastCode contains a string that uniquely identifies this Webcast $WebcastCode = $WebcastCreateResponse->WebcastCode; if ($WebcastCreateResult == 0) { // WebcastCreate was successful // WebcastGet Method // Retrieves the data for a Webcast $WebcastGetParameters = new stdClass(); $WebcastGetParameters->Username = $username; $WebcastGetParameters->Password = $password; $WebcastGetParameters->WebcastCode = $WebcastCode; // Call the WebcastGet method $WebcastGetResponse = $client->WebcastGet($WebcastGetParameters); // WebcastGetResult contains an integer // that indicates the success or failure of your request $WebcastGetResult = $WebcastGetResponse->WebcastGetResult; // Webcast contains the Webcast data object $Webcast = $WebcastGetResponse->Webcast; if ($WebcastGetResult == 0) { // WebcastGet was successful // Check if this webcast has a Topics array, if not create it if (!property_exists($Webcast->TopicsModule->Topics, "Topic")) { $Webcast->TopicsModule->Topics->Topic = array(); } // Create a new Topic and add it to our Webcast $NewTopic = new stdClass(); $NewTopic->Title = "New Topic Title"; $NewTopic->Description = "New Topic Description"; $NewTopic->Reference = "Arbitrary Identifier"; $NewTopic->Tags->string = array("some","new","tags"); $NewTopicAttachment = new stdClass(); $NewTopicAttachment->Description = "Attachment Description"; $NewTopicAttachment->Url = "Attachment Url"; $NewTopic->Attachments->TopicAttachment = array(); array_push($NewTopic->Attachments->TopicAttachment, $NewTopicAttachment); array_push($Webcast->TopicsModule->Topics->Topic, $NewTopic); // WebcastSave Method // Saves changes to a Webcast $WebcastSaveParameters = new stdClass(); $WebcastSaveParameters->Username = $username; $WebcastSaveParameters->Password = $password; $WebcastSaveParameters->Webcast = $Webcast; // Call the WebcastSave method $WebcastSaveResponse = $client->WebcastSave($WebcastSaveParameters); // WebcastSaveResult is an integer that indicates the // success or failure of your request $WebcastSaveResult = $WebcastSaveResponse->WebcastSaveResult; // As you create new webcasts and make changes to existing ones, // the ManagementService wants you to make sure you are always // working on the most recent version of that webcast. // It does this through the Webcast->WebcastRevision property, // which is a string that is automatically updated with every // change made to a Webcast. Here WebcastSave returns it for us // in the response. $WebcastRevision = $WebcastSaveResponse->WebcastRevision; if ($WebcastSaveResult == 0) { // WebcastSave method was successful // Webcast Delete Method // Deletes a Webcast $WebcastDeleteParameters = new stdClass(); $WebcastDeleteParameters->Username = $username; $WebcastDeleteParameters->Password = $password; $WebcastDeleteParameters->WebcastCode = $WebcastCode; $WebcastDeleteParameters->WebcastRevision = $WebcastRevision; // Call the WebcastDeleteMethod $WebcastDeleteResponse = $client->WebcastDelete($WebcastDeleteParameters); // WebcastDeleteResult is an integer that indicates the // success or failure of your request $WebcastDeleteResult = $WebcastDeleteResponse->WebcastDeleteResult; if ($WebcastDeleteResult == 0) { // WebcastDelete method was successful $celebrate = true; } } } } } } ?>