美文网首页
SAP OData 服务关于本地文件作为附件上传的一些错误消息

SAP OData 服务关于本地文件作为附件上传的一些错误消息

作者: 华山令狐冲 | 来源:发表于2022-12-22 11:57 被阅读0次

错误消息:

{
    "error": {
        "code": "005056A509B11EE3AEB5819C07C69E2F",
        "message": {
            "lang": "en",
            "value": "The server is refusing to process the request because the entity has an unsupported format"
        },
        "innererror": {
            "transactionid": "E472723D614C01E0E0063942C05FFFDA",
            "timestamp": "20221221083147.9877050",
            "Error_Resolution": {
                "SAP_Transaction": "For backend administrators: run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details",
                "SAP_Note": "See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)"
            }
        }
    }
}

当前传进来的文件类型:text/plain


支持的文件类型:


在 gm4 使用 Opportunity 进行测试:上传一张图片:


成功创建附件,201 created:


上传文本文件:


如果是 media 的话,所有的类型都支持:


关于输入参数 iv_slug 为空的问题:https://answers.sap.com/questions/12359446/uploadcollection-parameter-slug-does-not-work-anym.html

Service Builder 提供了生成模型提供程序类 (MPC) 的选项。 如果在模型中维护注释,生成的 MPC 类也支持内联注释。

  • 使用基于词汇的注释(Service with Vocabulary-based Annotations)创建服务类型的项目。
  • 导入词汇表。
  • 单击生成运行时对象以生成 MPC 类。
  • 方法 DEFINE_VOCAB_ANNOTATIONS 在模型提供者类中创建以维护基于词汇表的注释。

对于带有 SAP 注释的项目类型服务,将不会创建方法 DEFINE_VOCAB_ANNOTATIONS。

词汇引用在方法 DEFINE_VOCAB_ANNOTATIONS 中创建。

示例代码如下:

lo_reference = vocab_anno_model->create_vocabulary_reference(
                                iv_vocab_id = 'ZCAPABILITIES'
                                iv_vocab_version = '0001').

  lo_reference->create_include( iv_namespace = 'Org.OData.Capabilities.V1'
                                iv_alias     = 'UI' ).

生成项目后,Service Builder 会生成注释提供程序类 (APC,是 Annotation Provider Class 的缩写) 的类。APC 将仅为类型为引用服务的注释模型的项目(Annotation Model for Referenced Service)生成。

APC 生成并存储在树区域的 Runtime Artifacts 文件夹中。 显示生成结果的消息也显示在批量编辑视图中。 方法 DEFINE_VOCAB_ANNOTATIONS 将在 APC 中创建以维护基于词汇表的注释。

示例代码为:

lo_reference = vocab_anno_model->create_vocabulary_reference( iv_vocab_id = '/IWBEP/VOC_CORE'  iv_vocab_version = '0001').
  lo_reference->create_include( iv_namespace = 'Org.OData.Core.V1' ).

相关文章

网友评论

      本文标题:SAP OData 服务关于本地文件作为附件上传的一些错误消息

      本文链接:https://www.haomeiwen.com/subject/hdlmqdtx.html