in dubbo-admin-server/src/main/java/org/apache/dubbo/admin/controller/ApiDocsController.java [109:154]
public String callDubboService(CallDubboServiceRequest dubboCfg, @RequestBody List<CallDubboServiceRequestInterfaceParam> methodparams){
String[] paramTypes = null;
Object[] paramValues = null;
if(null != methodparams && !methodparams.isEmpty()){
paramTypes = new String[methodparams.size()];
paramValues = new Object[methodparams.size()];
for(int i = 0; i < methodparams.size(); i++){
CallDubboServiceRequestInterfaceParam param = methodparams.get(i);
paramTypes[i] = param.getParamType();
Object paramValue = param.getParamValue();
if(isBaseType(param.getParamType()) && null != paramValue){
if(paramValue instanceof Map){
Map<?, ?> tempMap = (Map<?, ?>) paramValue;
if(!tempMap.isEmpty()) {
Object tempParamValue = tempMap.values().stream().findFirst().orElse(null);
paramValues[i] = this.emptyString2Null(tempParamValue);
}
} else {
paramValues[i] = emptyString2Null(paramValue);
}
} else {
this.emptyString2Null(paramValue);
paramValues[i] = paramValue;
}
}
}
if (null == paramTypes) {
paramTypes = new String[0];
}
if (null == paramValues) {
paramValues = new Object[0];
}
try {
CompletableFuture<Object> future = ApiDocsDubboGenericUtil.invoke(dubboCfg.getRegistryCenterUrl(), dubboCfg.getInterfaceClassName(),
dubboCfg.getMethodName(), dubboCfg.isAsync(), dubboCfg.getVersion(), paramTypes, paramValues, dubboCfg.getGroup());
try {
Object objResult = future.get();
return JSON.toJSONString(objResult, CLASS_NAME_PRE_FILTER);
} catch (InterruptedException | ExecutionException e) {
LOG.error(e.getMessage(), e);
return "Some exceptions have occurred, please check the log.";
}
} catch (Exception e) {
return "Error '" + e.getMessage() + "' happened when loading docs from remote. Please make sure api-docs dependency is correctly added to Dubbo providers, check the following link for more instructions: https://cn.dubbo.apache.org/zh-cn/overview/reference/admin/";
}
}