首頁  >  問答  >  主體

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粉432930081179 天前425

全部回覆(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
  • 取消回覆