Cisco Cisco TelePresence Management Suite (TMS) Version 15 Developer's Guide

Page of 53
Error codes and error handling
Cisco TMSBA Programming Reference Guide
Page 46 of 53
Error handling example
If the Cisco TMS server is operational with the proper licenses, errors are caused by sending the wrong 
parameters to the API, such as trying to create a booking in the past, or trying to get systems, users, or 
conferences from Cisco TMS using the wrong ID. When an exception is caught, it is generally an indication 
that the client call must be changed before it is sent again.
Exceptions
All errors generated from the API are SoapExceptions, hence each time a save operation is performed 
against the API, the code should handle exceptions of type SoapException.
The message field of the exception will contain a string with a description of what went wrong. In many 
cases, displaying this information to the user will be helpful.
Code example
The code shows how to handle errors generated from API calls.
// Specify username and password to authenticate to service.
 
// (Can also be done in web.config)
 
NetworkCredential credentials = new NetworkCredential("xxx", "yyy", "ZZZ");
 
 
 
BookingService bookingService = new BookingService();
 
bookingService.Credentials = credentials;
 
 
 
// Set API to use version 9
 
if (bookingService.ExternalAPIVersionSoapHeaderValue == null)
 
bookingService.ExternalAPIVersionSoapHeaderValue = new 
BookingService.ExternalAPIVersionSoapHeader();
 
bookingService.ExternalAPIVersionSoapHeaderValue.ClientVersionIn = 9;
 
 
 
// Get a default conference object, where most common values are set
 
// (using default values specified in TMS)
 
Conference conference = bookingService.GetDefaultConference();
 
 
 
// Create an array of participants
 
Participant[] participants = new Participant[2];
 
 
 
// Create the elements of the array (the actual participants)
 
participants[0] = new Participant();
 
participants[0].ParticipantCallType = ParticipantType.IPVideo1; // Dial-out video
 
participants[0].NameOrNumber = "10.47.8.170";
 
 
 
participants[1] = new Participant();
 
participants[1].ParticipantCallType = ParticipantType.IPVideo1; // Dial-out video
 
participants[1].NameOrNumber = "10.47.8.171";
 
 
 
// Add the participants to the conference.
 
conference.Participants = participants;
 
 
 
// Set start date to December 12, 2012
 
DateTime startTime = new DateTime(2012, 12, 12, 10,00,00);