cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
748
Views
0
Helpful
2
Replies

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

pthakur01
Level 1
Level 1

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&amp;MK=628501508&amp;AN=Soniya Moholkar&amp;AE=smoholka@ccrn.com</meet:joinMeetingURL><meet:inviteMeetingURL>https://apidemoeu.webex.com/apidemoeu/j.php?ED=305522212&amp;UID=0&amp;RT=MiM3</meet:inviteMeetingURL><meet:registerMeetingURL>https://apidemoeu.webex.com/apidemoeu/j.php?ED=305522212&amp;UID=0&amp;RG=1&amp;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.

  1. 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

2 Replies 2

pthakur01
Level 1
Level 1

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.

Has anyone tried implementing XML API 8.0 SP3 in Java?