[英]Usage of com.sap.cloud.sdk.s4hana.connectivity.rfc.BapiQuery inside Spring RestController
我正在嘗試從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方法。 那就是問題所在。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.