简体   繁体   English

使用空键字段查询 OData v2 时出现“404 - 未找到资源”

[英]"404 - Resource not found" when query OData v2 with empty key field

I have an SAP CDS View exposed via Gateway and hosted on APIM.我有一个通过网关公开并托管在 APIM 上的 SAP CDS 视图。 This CDS has CRUD operations enabled using @ObjectModel annotations.此 CDS 使用 @ObjectModel 注释启用了 CRUD 操作。

One of the key fields from the CDS (SAP table) can be empty as per business process, but when I try to query for this full key via APIM service (with the empty property) I receive 404 - Resource not found:根据业务流程,CDS(SAP 表)中的关键字段之一可以为空,但是当我尝试通过 APIM 服务(具有空属性)查询此完整键时,我收到 404 - 找不到资源:

来自 APIM 的查询

The same query works fine inside SAP Gateway:同样的查询在 SAP Gateway 中运行良好:

直接来自 SAP Gateway 的相同查询

What should I do in order to APIM understand that this key field can receive empty (or null?) values?我应该怎么做才能让 APIM 明白这个关键字段可以接收空值(或 null?)?

It is interesting to see this from the APIM service and gateway query, the result is different given the same query parameter, the only explanation to me is that there is a conversion at ABAP side and this cause no result can be loaded.从 APIM 服务和网关查询中看到这一点很有趣,给定相同的查询参数,结果不同,对我的唯一解释是在 ABAP 端进行了转换,导致无法加载结果。 Can you enable gateway trace at ABAP side to check the exact request when ABAP tries to query data when you use APIM client?当您使用 APIM 客户端时,ABAP 尝试查询数据时,您能否在 ABAP 端启用网关跟踪以检查确切的请求? Use transaction /IWNFD/TRACES to see the traces for your user at ABAP side.使用事务 /IWNFD/TRACES 在 ABAP 端查看您的用户的跟踪。

Regards, Derek问候,德里克

Thanks for the answers!感谢您的回答!

We have found out that it might be an APIM mapping issue because when we set an empty key on the path (charg='') we receive a 404 without even reaching SAP Gateway:我们发现这可能是 APIM 映射问题,因为当我们在路径 (charg='') 上设置一个空键时,我们甚至没有到达 SAP Gateway 就收到了 404:

来自 APIM 的状态为 404 的消息

But when we set this same parameter with a blank / space (charg=' '), it works fine and it finds the entry on S4 table:但是当我们用空白/空格 (charg=' ') 设置相同的参数时,它工作正常并且它在 S4 表上找到条目:

来自 SAP 的状态为 200 的消息

How do I know it didn't reach S4?我怎么知道它没有达到 S4? First, because the trace doesn't catch anything and second because the 404 message is differente when it comes from S4:首先,因为跟踪没有捕捉到任何东西,其次,因为来自 S4 的 404 消息是不同的:

来自 SAP 的状态为 404 的消息

Thank you all!谢谢你们!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 jsp中的404(找不到资源) - 404 (resource not found) in jsp 自己的 Nuget 服务器 - '' 处的 V2 提要返回了一个意外的状态代码 '404 Not Found' - Own Nuget Server - The V2 feed at '' returned an unexpected status code '404 Not Found' microsoft face api 错误资源未找到(404) - microsoft face api error Resource not found(404) 我应该在导致空集的资源上返回 404 错误吗? - Should I return a 404 error on a resource resulting in empty set? 尚未定义的资源和未找到的请求数据的404状态 - 404 status for both a resource that is not yet defined and a requested data that is not found 无法加载资源:服务器在Spring MVC中以404(未找到)状态响应 - Failed to load resource: the server responded with a status of 404 (Not Found) in spring mvc 导出pdf-加载资源失败:服务器响应状态为404(未找到) - Exporting a pdf - Failed to load resource: the server responded with a status of 404 (Not Found) OData v4的函数字符串参数中的字符“ E”导致404错误 - Character 'E' in OData v4's function string parameter is causing 404 error 对Controller中的JsonResult进行Ajax调用失败,并显示404错误,“未找到资源” - Ajax call to JsonResult in Controller fails with 404 error, “resource not found” 加载资源失败:服务器响应状态为 404 (Not Found) webfonts - Failed to load resource: the server responded with a status of 404 (Not Found) webfonts
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM