class DaprClientHttp extends AbstractDaprClient {

  public <T> Mono<Response<T>> invokeService(InvokeServiceRequest invokeServiceRequest, TypeRef<T> type) {
    try {
      final String appId = invokeServiceRequest.getAppId();
      final String method = invokeServiceRequest.getMethod();
      final Object request = invokeServiceRequest.getBody();
      final Map<String, String> metadata = invokeServiceRequest.getMetadata();
      final HttpExtension httpExtension = invokeServiceRequest.getHttpExtension();
      final Context context = invokeServiceRequest.getContext();
      if (httpExtension == null) {
        throw new IllegalArgumentException("HttpExtension cannot be null. Use HttpExtension.NONE instead.");
      }
      // If the httpExtension is not null, then the method will not be null based on checks in constructor
      String httMethod = httpExtension.getMethod().toString();
      if (appId == null || appId.trim().isEmpty()) {
        throw new IllegalArgumentException("App Id cannot be null or empty.");
      }
      if (method == null || method.trim().isEmpty()) {
        throw new IllegalArgumentException("Method name cannot be null or empty.");
      }
      String path = String.format("%s/%s/method/%s", INVOKE_PATH, appId, method);
      byte[] serializedRequestBody = objectSerializer.serialize(request);
      Mono<DaprHttp.Response> response = this.client.invokeApi(httMethod, path,
          httpExtension.getQueryString(), serializedRequestBody, metadata, context);
      return response.flatMap(r -> {
        try {
          T object = objectSerializer.deserialize(r.getBody(), type);
          if (object == null) {
            return Mono.empty();
          }

          return Mono.just(object);
        } catch (Exception ex) {
          return Mono.error(ex);
        }
      }).map(r -> new Response(context, r));
    } catch (Exception ex) {
      return Mono.error(ex);
    }
  }

    DaprClientHttp(DaprHttp client, DaprObjectSerializer objectSerializer, DaprObjectSerializer stateSerializer);
    DaprClientHttp(DaprHttp client);

}