Using swagger generated client stubs for java RRS feed

  • Question

  • I will need to be able to invoke R based services from java, and have used swagger codegen to generate java client classes for the sample "mtservice" web service that I have started from Visual Studio.  I am running a "one-box" configuration, and am able to invoke the service from R after logging in with user admin and the password I have set for that user.  Just as a first step I would like to do the same from a java client.  I have used the "login" request as follows and received an access token in return, but I am baffled about how to use it.

    ApiClient apiClient = new ApiClient();

    LoginRequest loginRequest = new LoginRequest();
    UserApi userApi= new UserApi(apiClient);
    AccessTokenResponse accessTokenResponse = userApi.login(loginRequest);
    String accessToken = accessTokenResponse.getAccessToken();

    This throws an exception "No OAuth2 authentication configured. "

    Can anybody give me a hint as to how to proceed from here?

    Monday, June 26, 2017 8:57 PM