我正在尝试从 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);
}
任何想法为什么会出现这个错误?