我正在尝试从Spring REST控制器调用BAPI。
后端系统的调用工作正常,但是返回ResponseEntity
会导致错误“此响应已调用getOutputStream()
”
@RequestMapping( method = RequestMethod.GET )
public ResponseEntity<List<ExportingCostCenterInformation>> getBusinessPartners()
{
final ErpEndpoint endpoint = new ErpEndpoint(new ErpConfigContext("ErpQueryEndpoint_RFC"));
final BapiQuery query = new BapiQuery("BAPI_COSTCENTER_GETLIST")
.withExporting("CONTROLLINGAREA", "KOKRS", "1000");
List<ExportingCostCenterInformation> ecci = null;
try {
ecci = query.execute(endpoint)
.get("COSTCENTER_LIST")
.getAsCollection()
.asList(ExportingCostCenterInformation.class);
} catch (UnsupportedOperationException | IllegalArgumentException | QuerySerializationException | DestinationNotFoundException | DestinationAccessException | QueryExecutionException e) {
// ...
}
return ResponseEntity.ok(ecci);
}
任何想法为什么会出现此错误?
最佳答案
未正确定义类ExportingCostCenterInformation的getter和setter方法。那就是问题所在。