AttivitaDidattica getRelatedCorso() { mProtocolCarrier = new ProtocolCarrier(taskcontext, SmartUniDataWS.TOKEN_NAME); MessageRequest request = new MessageRequest( SmartUniDataWS.URL_WS_SMARTUNI, SmartUniDataWS.GET_WS_COURSES_DETAILS(GDS.getCorso())); request.setMethod(Method.GET); MessageResponse response; String body = null; try { response = mProtocolCarrier.invokeSync( request, SmartUniDataWS.TOKEN_NAME, MyUniActivity.getAuthToken()); if (response.getHttpStatus() == 200) { body = response.getBody(); } else { return null; } } catch (ConnectionException e) { e.printStackTrace(); } catch (ProtocolException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (AACException e) { e.printStackTrace(); } return Utils.convertJSONToObject(body, AttivitaDidattica.class); }
private List<CorsoCarriera> getFollowingCourses() { mProtocolCarrier = new ProtocolCarrier(context, SmartUniDataWS.TOKEN_NAME); MessageRequest request = new MessageRequest( SmartUniDataWS.URL_WS_SMARTUNI, SmartUniDataWS.GET_WS_MY_COURSES_NOT_PASSED); request.setMethod(Method.GET); @SuppressWarnings("unused") BasicProfile bp = new BasicProfile(); MessageResponse response; try { response = mProtocolCarrier.invokeSync( request, SmartUniDataWS.TOKEN_NAME, MyUniActivity.getAuthToken()); if (response.getHttpStatus() == 200) { body = response.getBody(); } else { return null; } } catch (ConnectionException e) { e.printStackTrace(); } catch (ProtocolException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (AACException e) { e.printStackTrace(); } return Utils.convertJSONToObjects(body, CorsoCarriera.class); }