[英]"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 - 找不到资源:
The same query works fine inside 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:
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 表上找到条目:
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 消息是不同的:
Thank you all!谢谢你们!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.