Java Class Cast Exception while parsing bodyContent to GetjoinurlMeetingResponse using XML API 8.0 SP3

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2014 06:00 AM - edited 03-01-2019 02:44 AM
Hello,
I'm getting the following exception trying to cast bodyContent to GetjoinurlMeetingResponse.
We are using JAXB to marshaling and un-marshaling of the WebEx request and response using XML API 8.0 SP3.
While registering with WebEx, the registration is being done successfully. After registration while getting the WebEx URL, we are getting the response in following format.
<?xml version="1.0" encoding="ISO-8859-1"?><serv:message xmlns:serv="http://www.webex.com/schemas/2002/06/service" xmlns:com="http://www.webex.com/schemas/2002/06/common" xmlns:meet="http://www.webex.com/schemas/2002/06/service/meeting" xmlns:att="http://www.webex.com/schemas/2002/06/service/attendee"><serv:header><serv:response><serv:result>SUCCESS</serv:result><serv:gsbStatus>PRIMARY</serv:gsbStatus></serv:response></serv:header><serv:body><serv:bodyContent xsi:type="meet:GetjoinurlMeetingResponse" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><meet:joinMeetingURL>https://apidemoeu.webex.com/apidemoeu/m.php?AT=JM&MK=628501508&AN=Soniya Moholkar&AE=smoholka@ccrn.com</meet:joinMeetingURL><meet:inviteMeetingURL>https://apidemoeu.webex.com/apidemoeu/j.php?ED=305522212&UID=0&RT=MiM3</meet:inviteMeetingURL><meet:registerMeetingURL>https://apidemoeu.webex.com/apidemoeu/j.php?ED=305522212&UID=0&RG=1&RT=MiM3</meet:registerMeetingURL></serv:bod...>
Following is the code to un-marshal the response:
JAXBContext jaxbContext = JAXBContext.newInstance("com.webex.schemas._2002._06.common:"
+ "com.webex.schemas._2002._06.service:"
+ "com.webex.schemas._2002._06.service.history");
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
MessageType response = (MessageType) ((JAXBElement) unmarshaller.unmarshal(new StringReader(responseXML))).getValue();
List<ResponseType> responseType = response.getHeader().getResponse();
if(responseType != null && !responseType.isEmpty())
{
GetjoinurlMeetingResponse meetingResponse = null;
if(responseType.get(0).getResult().equals(ResultTypeType.SUCCESS))
{
List<BodyContentType> bodyContent = response.getBody().getBodyContent();
meetingResponse = (GetjoinurlMeetingResponse) bodyContent.get(0);
}
}
But we are getting ClassCastException at the highlighted line.
- java.lang.ClassCastException: com.webex.schemas._2002._06.service.BodyContentType cannot be cast to com.webex.schemas._2002._06.service.meeting.GetjoinurlMeetingResponse
Same problem is also seen for RegisterMeetingAttendeeResponse. I'm attaching the XSD files and zipped Java classes I generated using Eclipse from the 8.0 SP3 .xsd files.
Kindly help me out.
Thank you.
Regards,
Pranav Thakur
- Labels:
-
General

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2014 06:03 AM
I'm using XJC bundled with JDK 6 to convert the XSD files into Java classes. Is this the right way? I also tried using XMLBeans instead of XJC but the same problem occurred.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2014 10:35 PM
Has anyone tried implementing XML API 8.0 SP3 in Java?
