cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Community Helping Community

283
Views
0
Helpful
2
Replies
Highlighted
Beginner

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

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
Beginner

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

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.

Beginner

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

Has anyone tried implementing XML API 8.0 SP3 in Java?

CreatePlease to create content
Content for Community-Ad
FusionCharts will render here