搜索

首页  >  问答  >  正文

SAPUI5 callFunction()调用后,Errorhandler未被调用

我正在尝试在 SAPUI5 中的向导中验证 IBAN。为此,我在 V2 ODataModel (sap.ui.model.odata.v2.ODataModel) 上使用 functionImport

该请求返回了 202 状态代码,但实际上失败了。 这是响应(来自 Firefox 网络选项卡):

--1D57E7CB0DD73AB15048B36CC96993D60
Content-Type: multipart/mixed; boundary=1D57E7CB0DD73AB15048B36CC96993D61
Content-Length:         1303

--1D57E7CB0DD73AB15048B36CC96993D61
Content-Type: application/http
Content-Length: 1134
content-transfer-encoding: binary

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 950
dataserviceversion: 1.0
cache-control: no-cache, no-store
pragma: no-cache
content-id: id-1687346500037-256

{"d":{"CheckIBAN":{"__metadata":{"type":"XXXX"},"AccountID":"XXXXXX","IBAN":"DEXXXX","BankID":"","WithInOutPayment":true,"SepaNotifText":"XXX"}}}
--1D57E7CB0DD73AB15048B36CC96993D61--

--1D57E7CB0DD73AB15048B36CC96993D60
Content-Type: application/http
Content-Length: 1111
content-transfer-encoding: binary

HTTP/1.1 400 Bad Request
Content-Type: application/json;charset=utf-8
Content-Length: 991
dataserviceversion: 1.0

{"error":{"code":"XXX/076","message":{"lang":"de","value":"XXX"},"innererror":{"application":{"component_id":"XXX","service_namespace":"XXX","service_id":"XXXX","service_version":"0001"},"transactionid":"XXX","timestamp":"XXX","Error_Resolution":{"SAP_Transaction":"XXX","SAP_Note":"XXXX"},"errordetails":[{"code":"XXX/076","message":"XXX","propertyref":"","severity":"error","target":""}]}}}
--1D57E7CB0DD73AB15048B36CC96993D60--

(删除所有机密内容) 这是浏览器控制台中的结果:

所以它必须在某个地方注册。 我注册回调的代码如下:

this.SERVICE.functionImport("CheckIBAN", XXX.Constants.HTTP_POST, XXX, true, {
            fnSuccess: jQuery.proxy(function (oData) {
                fnCallback(oData);
            }, this),
            fnError: fnError
        });

请注意,functionImport 函数只是 sap.ui.model.odata.v2.ODataModel.callFunction 的包装器,并且执行相同的操作。

无论我输入什么(正确或错误的输入),它总是调用fnSuccess

当我使用 ODataModelread 函数(所以只是一个简单的 GET-request)时,一切正常,并且在发生错误时触发 fnError

P粉432930081P粉432930081239 天前546

全部回复(1)我来回复

  • P粉338969567

    P粉3389695672024-04-05 00:39:04

    您的问题不包含问题“?”

    我假设您问为什么不调用“error”?

    如果http请求失败,则调用“error”。当您使用批处理时,changeSet 中的任何错误都不会由此 API 处理...UI5 v2 不是一个非常优雅的实现...

    另请参阅:https://github.com/SAP/openui5/问题/1382#issuecomment-288723906

    回复
    0
  • 取消回复