You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the getResponse function from https://github.com/FederatedAI/FATE-Serving/blob/master/fate-serving-common/src/main/java/com/webank/ai/fate/serving/common/utils/HttpAdapterClientPool.java,
private static HttpAdapterResponse getResponse(HttpRequestBase request) {
CloseableHttpResponse response = null;
try {
response = HttpClientPool.getConnection().execute(request,
HttpClientContext.create());
HttpEntity entity = response.getEntity();
String result = EntityUtils.toString(entity, Dict.CHARSET_UTF8);
return JsonUtil.json2Object(result, HttpAdapterResponse.class); <--will always return null,
}
...
}
JsonUtil.json2Object(result, HttpAdapterResponse.class) will always return null, because the result is not an HttpAdapterResponse object.
solution
1.update getResponse fucntion like this.
2.rename HttpAdapterByHeader class to HttpAdapter, these two classes are duplicated.
try {
...
String data = EntityUtils.toString(entity, Dict.CHARSET_UTF8);
int statusCode = response.getStatusLine().getStatusCode();
HttpAdapterResponse result = new HttpAdapterResponse();
result.setCode(statusCode);
result.setData(JsonUtil.json2Object(data,Map.class)); #data is only an Map<String,Object> object in HttpAdapterResponse
return result;
} catch (IOException ex) {
...
} finally {
...
}
The text was updated successfully, but these errors were encountered:
@wufan1991
Symptom
In the getResponse function from https://github.com/FederatedAI/FATE-Serving/blob/master/fate-serving-common/src/main/java/com/webank/ai/fate/serving/common/utils/HttpAdapterClientPool.java,
private static HttpAdapterResponse getResponse(HttpRequestBase request) {
CloseableHttpResponse response = null;
try {
response = HttpClientPool.getConnection().execute(request,
HttpClientContext.create());
HttpEntity entity = response.getEntity();
String result = EntityUtils.toString(entity, Dict.CHARSET_UTF8);
return JsonUtil.json2Object(result, HttpAdapterResponse.class); <--will always return null,
}
...
}
JsonUtil.json2Object(result, HttpAdapterResponse.class) will always return null, because the result is not an HttpAdapterResponse object.
solution
1.update getResponse fucntion like this.
2.rename HttpAdapterByHeader class to HttpAdapter, these two classes are duplicated.
try {
...
String data = EntityUtils.toString(entity, Dict.CHARSET_UTF8);
int statusCode = response.getStatusLine().getStatusCode();
HttpAdapterResponse result = new HttpAdapterResponse();
result.setCode(statusCode);
result.setData(JsonUtil.json2Object(data,Map.class)); #data is only an Map<String,Object> object in HttpAdapterResponse
return result;
} catch (IOException ex) {
...
} finally {
...
}
The text was updated successfully, but these errors were encountered: