cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
174
Views
0
Helpful
0
Comments
cdnadmin
Community Member
This document was generated from CDN thread

Created by: Mike Sava on 15-03-2010 10:14:04 PM
I tried using the BOOKING API but the format of the start/end Dates seems to be giving me an error. The samples are not in Java so I am not sure what the format should be in. Right now I am using: SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");

but that is obviously not correct.

BookingServiceLocator locator = new BookingServiceLocator();
locator.setBookingServiceSoap12EndpointAddress("http://127.0.0.1/tms/external/booking/bookingservice.asmx?WSDL"); //IP not real
BookingServiceSoap service = locator.getBookingServiceSoap();

((Stub) service)._setProperty(Call.USERNAME_PROPERTY, "uid"); // uid not real
((Stub) service)._setProperty(Call.PASSWORD_PROPERTY, "xxxxx"); // pw not real

Conference conference = service.getDefaultConference();

Participant [] participants = new Participant[2];
participants[0] = new Participant();
// ParticipantType.value1 = TMS
participants[0].setParticipantCallType( ParticipantType.value1);
participants[0].setNameOrNumber("Yorktown.02-135.STP1");
participants[1] = new Participant();
participants[1].setParticipantCallType( ParticipantType.value1);
participants[1].setNameOrNumber("bjripp.office");

conference.setParticipants(participants);
conference.setTitle("Mike Test conference");


SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");

/* Also tried the following

"yyyy-MM-dd'T'HH:mm:ss"
"yyyy-MM-dd HH:mm:ssZ"
"yyyy-MM-dd'T'HH:mm:ssZ"
"yyyy-MM-dd HH:mm:sszzzz"
"yyyy-MM-dd'T'HH:mm:ss.0000000Z"
"yyyy-MM-dd HH:mm:ss.0000000Z"
"yyyy-MM-dd'T'HH:mm:ss.0000000zzzz"

*/


Calendar cal = Calendar.getInstance();
cal.add( Calendar.DAY_OF_MONTH, 1);

Date startDate = cal.getTime();
cal.add( Calendar.HOUR, 1);
Date endDate = cal.getTime();


conference.setStartTimeUTC( sdf.format( startDate ));
conference.setEndTimeUTC( sdf.format( endDate ) );


conference = service.saveConference(conference);  // FAILS HERE with LOG ERROR BELOW



TMS LOG ERROR:

TMS Version 12.5 15:18:52,373 [5] ERROR Tandberg.TMS.External.SoapExceptionThrower - System.FormatException: String was not recognized as a valid DateTime. at System.DateTimeParse.ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style) at System.DateTime.ParseExact(String s, String format, IFormatProvider provider, DateTimeStyles style) at System.Xml.XmlConvert.ToDateTime(String s, String format) at Tandberg.TMS.External.Booking.ExTMSAttributeMapper.MakeDateTime(String UTCString) at Tandberg.TMS.External.Booking.ExTMSDataAdapter.FillConference(ExConference exConf, Int32 lModifyMask, IConference outConf) at Tandberg.TMS.External.Booking.BookingService.SaveConference(ExConference exConfIn, Boolean bSingleInstance, Boolean includeSIPAnd3G, Boolean includeWebconferenceAndRecordingUri)

Subject: RE: Third Party Booking API (java) failing
Replied by: Paul Currie on 07-05-2010 01:00:52 PM
Sorry for the late reply.


The Booking API expects UTC date strings to be on the form "yyyy-MM-dd HH:mm:ssZ".

Initializing the SimpleDateFormat class with the format string "yyyy-MM-dd HH:mm:ss'Z'" will produce the correct output for TMS.

I see you tried the format string "yyyy-MM-dd HH:mm:ssZ". The Z token in this string this will append the timezone information on the form '[+-]<4-digit-UTC-offset>' e.g. '+0200', and not the expected string literal 'Z'. Note that to produce the expected UTC time string output you will probably need to convert the Date object from local time to UTC time before calling format();
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links