HANA Express XSODATA 更新操作错误
HANA Express XSODATA update operation error
我有一个带有 XSA 的 SAP HANA Express 服务器,我创建了一个带有数据库和 NodeJS 模块的 MTA 应用程序,在 NodeJS 模块中我创建了一个连接到数据库模块的 .xsodata。
XSO数据定义:
service {
//Definición de servicios
"SISGASTOS"."CATEGORIA" as "Categoria"
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_categoria");
"SISGASTOS"."ESTADO" as "Estado"
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_estado");
"SISGASTOS"."PROYECTO" as "Proyecto"
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_proyecto");
"SISGASTOS"."TIPO_DOCUMENTO" as "TipoDoc"
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_tipo_documento");
"SISGASTOS"."INFORME" as "Informe"
navigates ("Informe_Comentario" as "Comentarios", "Informe_Proyecto" as "Proyecto", "Informe_Estado" as "Estado","Informe_Gasto" as "Gastos", "Informe_Hist" as "Info_Historial")
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_informe");
"SISGASTOS"."HIST_INFORME" as "Hist_Informe"
navigates ("Hist_Informe_Estado" as "Estado")
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_hist_informe");
"SISGASTOS"."COMENTARIO_INFORME" as "ComentarioInforme";
// create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_comentario_informe");
"SISGASTOS"."GASTO" as "Gasto"
navigates ("Gasto_Categoria" as "Categoria", "Gasto_TipoDoc" as "TipoDoc", "Gasto_Estado" as "Estado", "Gasto_Comentario" as "Comentarios", "Gasto_Anexo" as "Anexos", "Gasto_Hist" as "Gasto_Historial")
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_gasto");
"SISGASTOS"."HIST_GASTO" as "Hist_Gasto"
navigates ("Hist_Gasto_Estado" as "Estado")
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_hist_gasto");
"SISGASTOS"."COMENTARIO" as "Comentario"
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_comentario");
"SISGASTOS"."ANEXO" as "Anexo"
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_anexo");
//Asociacion Historiales
association "Hist_Gasto_Estado"
principal "Hist_Gasto"("ID_ESTADO") multiplicity "1"
dependent "Estado"("ID_ESTADO") multiplicity "1";
association "Hist_Informe_Estado"
principal "Hist_Informe"("ID_ESTADO") multiplicity "1"
dependent "Estado"("ID_ESTADO") multiplicity "1";
//Asociacion Informe
association "Informe_Comentario"
principal "Informe"("ID_INFORME") multiplicity "1"
dependent "ComentarioInforme"("ID_INFORME") multiplicity "*";
association "Informe_Proyecto"
principal "Informe"("ID_PROYECTO") multiplicity "1"
dependent "Proyecto"("ID_PROYECTO") multiplicity "1";
association "Informe_Estado"
principal "Informe"("ID_ESTADO") multiplicity "1"
dependent "Estado"("ID_ESTADO") multiplicity "1";
association "Informe_Gasto"
principal "Informe"("ID_INFORME") multiplicity "1"
dependent "Gasto"("ID_INFORME") multiplicity "*";
association "Informe_Hist"
principal "Informe"("ID_INFORME") multiplicity "1"
dependent "Hist_Informe"("ID_INFORME") multiplicity "*";
//Asociación Gasto
association "Gasto_Categoria"
principal "Gasto"("ID_CATEGORIA") multiplicity "1"
dependent "Categoria"("ID_CATEGORIA") multiplicity "1";
association "Gasto_TipoDoc"
principal "Gasto"("ID_TIPO_DOCUMENTO") multiplicity "1"
dependent "TipoDoc"("ID_TIPO_DOCUMENTO") multiplicity "1";
association "Gasto_Estado"
principal "Gasto"("ID_ESTADO") multiplicity "1"
dependent "Estado"("ID_ESTADO") multiplicity "1";
association "Gasto_Comentario"
principal "Gasto"("ID_GASTO") multiplicity "1"
dependent "Comentario"("ID_GASTO") multiplicity "*";
association "Gasto_Anexo"
principal "Gasto"("ID_GASTO") multiplicity "1"
dependent "Anexo"("ID_GASTO") multiplicity "*";
association "Gasto_Hist"
principal "Gasto"("ID_GASTO") multiplicity "1"
dependent "Hist_Gasto"("ID_GASTO") multiplicity "*";
}
我们使用更新操作从 SAPUI5 应用程序调用该服务。
submitChanges: function() {
this.getView().getModel("oModelDialogo").setProperty("/busy", true);
this.getView().getModel().submitChanges({
success: function(oResult) {
this.getView().getModel("oModelDialogo").setProperty("/busy", false);
console.log(oResult);
}.bind(this),
error: function(oError) {
this.getView().getModel("oModelDialogo").setProperty("/busy", false);
console.log(oError);
}.bind(this)
});
},
但是响应是 Not Implemented 501:
--batch_1523471867867_0
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 501 Not Implemented
Content-Type: application/json;charset=utf-8
{"error":{"code":501,"message":{"lang":"en-US","value":"Not implemented"}}}
读取、创建和删除操作正常,只有更新操作有问题。
编辑:
作为 0x17 建议,我将清单文件中的 defaultUpdateMethod 更改如下:
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "Adjuntos.i18n.i18n"
}
},
"": {
"dataSource": "mainService",
"preload": true,
"settings": {
"defaultBindingMode": "TwoWay",
"defaultUpdateMethod": "sap.ui.model.odata.UpdateMethod.Put"
}
}
},
这样更新请求就可以了!谢谢
你能请吗?检查更新操作期间发送的完整请求 headers?我想如果请求方法设置为 MERGE
可能会发生这种情况
我假设您在 ui5 app. However, in the HANA xsa 版本(基于 Cloudfoundry)OData V2 API 中使用 OData V2 模型,默认情况下不支持 MERGE。
您能否将 defaultUpdateMethod 设置为 PUT(在 manifest.json 中)并重试?您也可以像这样在控制器代码中更改相同内容
The OData v2 APIs in SCP Neo vs SAP XSA (based on cloudfoundry) have subtle differences. The latter is not as robust as the former when it comes to V2 APIs but it is slowly tilting towards the use of OData V4 APIs (which is good)
我有一个带有 XSA 的 SAP HANA Express 服务器,我创建了一个带有数据库和 NodeJS 模块的 MTA 应用程序,在 NodeJS 模块中我创建了一个连接到数据库模块的 .xsodata。
XSO数据定义:
service {
//Definición de servicios
"SISGASTOS"."CATEGORIA" as "Categoria"
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_categoria");
"SISGASTOS"."ESTADO" as "Estado"
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_estado");
"SISGASTOS"."PROYECTO" as "Proyecto"
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_proyecto");
"SISGASTOS"."TIPO_DOCUMENTO" as "TipoDoc"
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_tipo_documento");
"SISGASTOS"."INFORME" as "Informe"
navigates ("Informe_Comentario" as "Comentarios", "Informe_Proyecto" as "Proyecto", "Informe_Estado" as "Estado","Informe_Gasto" as "Gastos", "Informe_Hist" as "Info_Historial")
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_informe");
"SISGASTOS"."HIST_INFORME" as "Hist_Informe"
navigates ("Hist_Informe_Estado" as "Estado")
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_hist_informe");
"SISGASTOS"."COMENTARIO_INFORME" as "ComentarioInforme";
// create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_comentario_informe");
"SISGASTOS"."GASTO" as "Gasto"
navigates ("Gasto_Categoria" as "Categoria", "Gasto_TipoDoc" as "TipoDoc", "Gasto_Estado" as "Estado", "Gasto_Comentario" as "Comentarios", "Gasto_Anexo" as "Anexos", "Gasto_Hist" as "Gasto_Historial")
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_gasto");
"SISGASTOS"."HIST_GASTO" as "Hist_Gasto"
navigates ("Hist_Gasto_Estado" as "Estado")
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_hist_gasto");
"SISGASTOS"."COMENTARIO" as "Comentario"
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_comentario");
"SISGASTOS"."ANEXO" as "Anexo"
create events ( before "movilidad.rindegastos:Informe.xsjslib::crear_anexo");
//Asociacion Historiales
association "Hist_Gasto_Estado"
principal "Hist_Gasto"("ID_ESTADO") multiplicity "1"
dependent "Estado"("ID_ESTADO") multiplicity "1";
association "Hist_Informe_Estado"
principal "Hist_Informe"("ID_ESTADO") multiplicity "1"
dependent "Estado"("ID_ESTADO") multiplicity "1";
//Asociacion Informe
association "Informe_Comentario"
principal "Informe"("ID_INFORME") multiplicity "1"
dependent "ComentarioInforme"("ID_INFORME") multiplicity "*";
association "Informe_Proyecto"
principal "Informe"("ID_PROYECTO") multiplicity "1"
dependent "Proyecto"("ID_PROYECTO") multiplicity "1";
association "Informe_Estado"
principal "Informe"("ID_ESTADO") multiplicity "1"
dependent "Estado"("ID_ESTADO") multiplicity "1";
association "Informe_Gasto"
principal "Informe"("ID_INFORME") multiplicity "1"
dependent "Gasto"("ID_INFORME") multiplicity "*";
association "Informe_Hist"
principal "Informe"("ID_INFORME") multiplicity "1"
dependent "Hist_Informe"("ID_INFORME") multiplicity "*";
//Asociación Gasto
association "Gasto_Categoria"
principal "Gasto"("ID_CATEGORIA") multiplicity "1"
dependent "Categoria"("ID_CATEGORIA") multiplicity "1";
association "Gasto_TipoDoc"
principal "Gasto"("ID_TIPO_DOCUMENTO") multiplicity "1"
dependent "TipoDoc"("ID_TIPO_DOCUMENTO") multiplicity "1";
association "Gasto_Estado"
principal "Gasto"("ID_ESTADO") multiplicity "1"
dependent "Estado"("ID_ESTADO") multiplicity "1";
association "Gasto_Comentario"
principal "Gasto"("ID_GASTO") multiplicity "1"
dependent "Comentario"("ID_GASTO") multiplicity "*";
association "Gasto_Anexo"
principal "Gasto"("ID_GASTO") multiplicity "1"
dependent "Anexo"("ID_GASTO") multiplicity "*";
association "Gasto_Hist"
principal "Gasto"("ID_GASTO") multiplicity "1"
dependent "Hist_Gasto"("ID_GASTO") multiplicity "*";
}
我们使用更新操作从 SAPUI5 应用程序调用该服务。
submitChanges: function() {
this.getView().getModel("oModelDialogo").setProperty("/busy", true);
this.getView().getModel().submitChanges({
success: function(oResult) {
this.getView().getModel("oModelDialogo").setProperty("/busy", false);
console.log(oResult);
}.bind(this),
error: function(oError) {
this.getView().getModel("oModelDialogo").setProperty("/busy", false);
console.log(oError);
}.bind(this)
});
},
但是响应是 Not Implemented 501:
--batch_1523471867867_0
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 501 Not Implemented
Content-Type: application/json;charset=utf-8
{"error":{"code":501,"message":{"lang":"en-US","value":"Not implemented"}}}
读取、创建和删除操作正常,只有更新操作有问题。
编辑:
作为 0x17 建议,我将清单文件中的 defaultUpdateMethod 更改如下:
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "Adjuntos.i18n.i18n"
}
},
"": {
"dataSource": "mainService",
"preload": true,
"settings": {
"defaultBindingMode": "TwoWay",
"defaultUpdateMethod": "sap.ui.model.odata.UpdateMethod.Put"
}
}
},
这样更新请求就可以了!谢谢
你能请吗?检查更新操作期间发送的完整请求 headers?我想如果请求方法设置为 MERGE
可能会发生这种情况我假设您在 ui5 app. However, in the HANA xsa 版本(基于 Cloudfoundry)OData V2 API 中使用 OData V2 模型,默认情况下不支持 MERGE。
您能否将 defaultUpdateMethod 设置为 PUT(在 manifest.json 中)并重试?您也可以像这样在控制器代码中更改相同内容
The OData v2 APIs in SCP Neo vs SAP XSA (based on cloudfoundry) have subtle differences. The latter is not as robust as the former when it comes to V2 APIs but it is slowly tilting towards the use of OData V4 APIs (which is good)