SFSF OData调用:无法将响应转换为ODataFeed:发生"EdmSimpleTypeException" [英] SFSF OData call: Failed to convert response into ODataFeed: An 'EdmSimpleTypeException' occurred

查看:128
本文介绍了SFSF OData调用:无法将响应转换为ODataFeed:发生"EdmSimpleTypeException"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是问题所在: 使用SAP Cloud SDK中的Java为SFSF生成VDM:生成的URI错误

我使用Maven从SFSF的元数据文件中生成了虚拟数据模型插件和适用于Java的SAP Cloud SDK.

I generated a Virtual Data Model from a metadata file from SFSF using the Maven plugin and SAP Cloud SDK for Java.

生成器正常工作,但是生成的URI不是SFSF期望的:

The generator works correctly, however the URI generated is not what SFSF is expecting:

  • 生成的URI:/odata/v2/SFODataSet

  • Generated URI: /odata/v2/SFODataSet

期望的URI:/odata/v2或/odata/v2/JobRequisition

Expected URI: /odata/v2 or /odata/v2/JobRequisition

(SFODataSet实体不存在,并且SFSF尝试访问它时给出错误).

(SFODataSet entity does not exist, and SFSF gives an error when trying to access it).

无论如何,我继续将生成的文件中的DEFAULT_SERVICE_PATH更改为/odata/v2 ,并创建包含查询的以下servlet:

Anyway, I proceed and change the DEFAULT_SERVICE_PATH in the generated files to /odata/v2 and create the following servlet that includes the query:

@WebServlet("/req")
public class JobReqServlet extends HttpServlet {

    private static final long serialVersionUID = 1L;
    private static final Logger logger = LoggerFactory.getLogger(JobReqServlet.class);

    private final ErpHttpDestination destination = DestinationAccessor.getDestination("sfsf-sdk-dest").asHttp()
            .decorate(DefaultErpHttpDestination::new);


    @Override
    protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
            throws ServletException, IOException {
        try {
            long id = 2126;
            final JobRequisition jobReqs = new DefaultRCMJobRequisitionService()
                .getJobRequisitionByKey(id)
                .execute(destination);
            response.getWriter().write("Done!");
        } catch (final ODataException e) {
            logger.error(e.getMessage(), e);
            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
            response.getWriter().write(e.getMessage());
        }
    }
}

这将查询单个作业申请(标识为2126).无需添加选项 .withServicePath(),因为它已被更改.

This queries a single job requisition (with the id 2126). There's no need to add the option .withServicePath() because it's already changed.

但是,在运行应用程序时,等待10到20秒后,我会收到内部服务器错误.

However, when running the app, I get an Internal Server Error after 10-20 second of waiting.

在日志中,我可以看到以下内容:

In the logs I can see the following:

  • 目的地已正确提取
  • HTTP请求正确
  • SFSF使用正确的数据进行响应

但是在接收到数据之后,就会出现错误:

But just after the data is received there's an error:

"com.sap.cloud.sdk.odatav2.connectivity.ODataQuery","thread":"http-nio-0.0.0.0-8080-exec-3","level":"ERROR","categories":[],"msg":"Failed to convert response into ODataFeed: An exception of type 'EdmSimpleTypeException' occurred." }

在云端硬盘中找到此处:

  • 调试日志(SDKapplogs.txt)
  • SFSF的JSON响应(response.json)

任何帮助将不胜感激.

推荐答案

用于生成VDM的EDMX文件与远程OData服务响应不兼容.请要求OData服务的维护者提供最新的元数据文件.您也可以尝试直接从http://[URL]/odata/v2/$metadata下载.

The EDMX file that you've used to generate the VDM from is not compatible with the remote OData service responses. Please ask the maintainer of the OData service to provide an up-to-date metadata file. You can also try and download it directly from http://[URL]/odata/v2/$metadata.

我发现您附加的JSON示例有效负载中约有一半与API Business Hub上发布的EDMX文件不兼容.

I found about half of the JSON sample payload that you attached was not compatible with the EDMX file published on API Business Hub.

  • 响应中包含无法与元数据匹配的未知实体属性:

  • The response contains unknown entity properties which cannot be matched with the metadata:

"departmentCode": null
"locationCode": null
"divisionCode": null
"costCenterCode": null
"instrGen": null
"legalEntityCode": null
"templateName": "Standard Job Requisition"
"routeMap": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/routeMap"}}
"motorVeh": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/motorVeh"}}
"payType": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/payType"}}
"requiredTravel": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/requiredTravel"}}
"state": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/state"}}
"jobProfile": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/jobProfile"}}
"division_obj": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/division_obj"}}
"legalEntity_obj": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/legalEntity_obj"}}
"jobReqFwdCandidates": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/jobReqFwdCandidates"}}
"status": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/status"}}
"budgeted": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/budgeted"}}
"jobApplications": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/jobApplications"}}
"shiftSchedule": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/shiftSchedule"}}
"interviewGuide": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/interviewGuide"}}
"jobAnalyzerReportingData": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/jobAnalyzerReportingData"}}
"assessment": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/assessment"}}
"adCode": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/adCode"}}
"flsa": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/flsa"}}
"costCenter_obj": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/costCenter_obj"}}
"filter1": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/filter1"}}
"filter2": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/filter2"}}
"filter3": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/filter3"}}
"eeoJobCat": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/eeoJobCat"}}
"location_objlist": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/location_objlist"}}
"accommo": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/accommo"}}
"experienceReq": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/experienceReq"}}
"relocationPack": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/relocationPack"}}
"rsnVacancy": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/rsnVacancy"}}
"location_obj": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/location_obj"}}
"competencies": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/competencies"}}
"department_obj": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/department_obj"}}
"PD": {"__deferred": {"uri": "https://[URL]/odata/v2/JobRequisition(2126L)/PD"}}

  • 响应中包含实体属性的意外null值,不允许该值为null:

  • The response contains unexpected null values for entity properties which are not allowed to be null:

    "closedDateTime": null
    "timeToFill": null
    "jobReqGUId": null
    "overallScaleName": null
    "lastModifiedProxyUserId": null
    "positionNumber": null
    "age": null
    

  • 不幸的是,错误没有得到适当处理,并且将关闭任何反序列化尝试.由于这是在 SAP Service SDK 的第三方 Olingo 库中发生的,因此我们无法修复或更改它,也无法提供有意义的解决方法.

    Unfortunately the errors are not handled gracefully and will shutdown any deserialization attempt. Since this is happening within the third party Olingo library of SAP Service SDK, we cannot fix or change it, or provide a meaningful workaround.

    您需要确保从头到尾使用正确的元数据文件.

    You will need to make sure the correct metadata file is used, from start to end.

    这篇关于SFSF OData调用:无法将响应转换为ODataFeed:发生"EdmSimpleTypeException"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆