我需要将系统变量“system.timestamp”的值保存到流量变量中。 (这样做是为了获得之间的一些标注政策的持续时间)在ApiGEE中带有非字符串值的流量变量
然而,由于AssignMessage政策引发的错,我不能读它:
{
"fault": {
"faultstring": "java.lang.Integer cannot be cast to java.lang.String",
"detail": {
"errorcode": "Internal Server Error"
}
}
}
不长,也没有整型值可以是阅读,只有字符串,这是有点奇怪,因为暴露变量的人不能读取的情况是什么?
我试图避免“非优雅”的Javascript政策,如果这是不可能的,所以这里我使用读取值[非常基本] AssignMessage政策:
<AssignMessage async="false" continueOnError="false" enabled="true" name="time-test">
<DisplayName>TimeTest</DisplayName>
<AssignVariable>
<Name>myvar</Name>
<Ref>system.timestamp</Ref>
</AssignVariable>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>
系统.timestamp变量记录在此处: http://apigee.com/docs/api-services/reference/variables-reference#-a-class-jumplink-name-system-a-system-variables
谢谢Mike,这是我的计划B.我会在我的问题中添加“没有javascript策略”的说明。 – Migs 2014-10-09 16:51:37