我想从请求的JSON正文中获取变量。目前,我在我的要求预流这种提取物变量政策:从请求正文中提取变量
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" continueOnError="true" enabled="true" name="extractvariables-grabrequestpayload">
<DisplayName>ExtractVariables-GrabRequestPayload</DisplayName>
<Source clearPayload="false">request</Source>
<FaultRules/>
<Properties/>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<JSONPayload>
<Variable name="payload">
<JSONPath>$</JSONPath>
</Variable>
<Variable name="method">
<JSONPath>$.method</JSONPath>
</Variable>
</JSONPayload>
<VariablePrefix>myprefix</VariablePrefix>
样本请求正文如下:
{ “方法”: “取消”, “ PARAMS “:{ ”分区“:” 05" , “itemnumber”: “1”, “recipientnumber”: “1”, “SKU”: “0JAX330000” } }
但是,我没有看到跟踪中的变量,尽管我可以看到content.request正确使用上面的JSON填充并且正在执行策略。我看不到任何引用来从请求主体中抓取这个,只有响应。这不可能吗?
我添加了一个脚本和政策来检查值。看起来最初的问题是内容类型头文件没有被设置为“application/json”。现在我看到负载变量正在被设置,但是没有使用上面包括的负载的方法变量。 – user3393335