code: @SuppressWarnings("unchecked")
      protected <R> R service(ServiceRequest<R> request) throws WssServiceException {
          R result;
          String response = "";
          try {
              HttpRequestBase httpRequest = createHttpRequest(request);
              RequestConfig requestConfig = RequestConfig.custom().setCookieSpec(CookieSpecs.STANDARD).build();
              httpRequest.setConfig(requestConfig);
  
              logger.trace("Calling White Source service: " + request);
              response = httpClient.execute(httpRequest, new BasicResponseHandler());
  
              String data = extractResultData(response);
              logger.trace("Result data is: " + data);
  
              switch (request.type()) {
                  case UPDATE:
                      result = (R) gson.fromJson(data, UpdateInventoryResult.class);
                      break;
                  case CHECK_POLICIES:
                      result = (R) gson.fromJson(data, CheckPoliciesResult.class);
                      break;
                  case CHECK_POLICY_COMPLIANCE:
                      result = (R) gson.fromJson(data, CheckPolicyComplianceResult.class);
                      break;
                  case CHECK_VULNERABILITIES:
                      result = (R) gson.fromJson(data, CheckVulnerabilitiesResult.class);
                      break;
                  case GET_DEPENDENCY_DATA:
                      result = (R) gson.fromJson(data, GetDependencyDataResult.class);
                      break;
                  case SUMMARY_SCAN:
                      result = (R) gson.fromJson(data, SummaryScanResult.class);
                      break;
                  case GET_CONFIGURATION:
                      result = (R) gson.fromJson(data, ConfigurationResult.class);
                      break;
                  default:
                      throw new IllegalStateException("Unsupported request type.");
              }
          } catch (JsonSyntaxException e) {
              throw new WssServiceException("JsonSyntax exception. Response data is:  " + response + e.getMessage(), e);
          } catch (IOException e) {
              throw new WssServiceException("Unexpected error. Response data is: " + response + e.getMessage(), e);
          }
  
          return result;
      }
docs: The method service the given request.
  
  @param request Request to serve.
  @return Result from WhiteSource service.
  @throws WssServiceException In case of errors while serving the request.