0

我正在尝试从 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);         
}

任何想法为什么会出现这个错误?

4

1 回答 1

1

ExportingCostCenterInformation 类的 getter 和 setter 方法没有很好地定义。这就是问题所在。

于 2018-05-16T10:16:31.583 回答