Source:
private OAuth2ClientApplicationDTO validateAccessToken(String accessTokenIdentifier) throws Exception { if (remoteServiceURL.startsWith(Constants.LOCAL_PREFIX)) { OAuth2TokenValidationRequestDTO oauthValidationRequest = new OAuth2TokenValidationRequestDTO(); OAuth2TokenValidationRequestDTO.OAuth2AccessToken accessToken = oauthValidationRequest.new OAuth2AccessToken(); accessToken.setTokenType(OAuthServiceClient.BEARER_TOKEN_TYPE); accessToken.setIdentifier(accessTokenIdentifier); oauthValidationRequest.setAccessToken(accessToken); OAuth2TokenValidationService oauthValidationService = new OAuth2TokenValidationService(); OAuth2ClientApplicationDTO oauthValidationResponse = oauthValidationService .findOAuthConsumerIfTokenIsValid(oauthValidationRequest); return oauthValidationResponse; } try { ConfigurationContext configContext = ConfigurationContextFactory .createConfigurationContextFromFileSystem(null, null); OAuthServiceClient oauthClient = new OAuthServiceClient(getOAuthAuthzServerURL(), userName, password, configContext); org.wso2.carbon.identity.oauth2.stub.dto.OAuth2ClientApplicationDTO validationResponse; validationResponse = oauthClient.findOAuthConsumerIfTokenIsValid(accessTokenIdentifier); OAuth2ClientApplicationDTO appDTO = new OAuth2ClientApplicationDTO(); appDTO.setConsumerKey(validationResponse.getConsumerKey()); OAuth2TokenValidationResponseDTO validationDto = new OAuth2TokenValidationResponseDTO(); validationDto.setAuthorizedUser(validationResponse.getAccessTokenValidationResponse() .getAuthorizedUser()); validationDto .setValid(validationResponse.getAccessTokenValidationResponse().getValid()); appDTO.setAccessTokenValidationResponse(validationDto); return appDTO; } catch (AxisFault axisFault) { throw axisFault; } catch (Exception exception) { throw exception; } }

Target:
private OAuth2ClientApplicationDTO validateAccessToken(String accessTokenIdentifier) throws RemoteException { if (remoteServiceURL.startsWith(Constants.LOCAL_PREFIX)) { OAuth2TokenValidationRequestDTO oauthValidationRequest = new OAuth2TokenValidationRequestDTO(); OAuth2TokenValidationRequestDTO.OAuth2AccessToken accessToken = oauthValidationRequest.new OAuth2AccessToken(); accessToken.setTokenType(OAuthServiceClient.BEARER_TOKEN_TYPE); accessToken.setIdentifier(accessTokenIdentifier); oauthValidationRequest.setAccessToken(accessToken); OAuth2TokenValidationService oauthValidationService = new OAuth2TokenValidationService(); OAuth2ClientApplicationDTO oauthValidationResponse = oauthValidationService .findOAuthConsumerIfTokenIsValid(oauthValidationRequest); return oauthValidationResponse; } try { ConfigurationContext configContext = ConfigurationContextFactory .createConfigurationContextFromFileSystem(null, null); OAuthServiceClient oauthClient = new OAuthServiceClient(getOAuthAuthzServerURL(), userName, password, configContext); org.wso2.carbon.identity.oauth2.stub.dto.OAuth2ClientApplicationDTO validationResponse; validationResponse = oauthClient.findOAuthConsumerIfTokenIsValid(accessTokenIdentifier); OAuth2ClientApplicationDTO appDTO = new OAuth2ClientApplicationDTO(); appDTO.setConsumerKey(validationResponse.getConsumerKey()); OAuth2TokenValidationResponseDTO validationDto = new OAuth2TokenValidationResponseDTO(); validationDto.setAuthorizedUser(validationResponse.getAccessTokenValidationResponse().getAuthorizedUser()); validationDto.setValid(validationResponse.getAccessTokenValidationResponse().getValid()); appDTO.setAccessTokenValidationResponse(validationDto); return appDTO; } catch (AxisFault axisFault) { throw axisFault; } catch (RemoteException e) { throw e; } }