【问题标题】:How can I copy response target endpoint response payload in a service callout policy with apigee?如何使用 apigee 在服务调出策略中复制响应目标端点响应负载?
【发布时间】:2015-09-03 02:23:39
【问题描述】:

我需要使用目标端点响应负载作为后续服务调出策略中的请求负载,通过 apigee 能够使用 3rd 方服务记录响应。

我尝试过使用:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="Create-New-Message">
    <DisplayName>Create New Message</DisplayName>
    <AssignTo createNew="true" type="request">newrequest</AssignTo>
    <Copy source='response'>
      <Payload>{response.content}</Payload>
    </Copy>
    <Set>
        <Verb>POST</Verb>
    </Set>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
</AssignMessage>

但有效载荷仍然是空的。

【问题讨论】:

  • 相当肯定您需要引用服务调用策略的名称作为前缀,例如myServiceCallout.response.content
  • 服务调出在响应流中的分配消息之后,因此它本身将使用分配消息更新的有效负载。所以会是这样的:&lt;Request clearPayload="false" variable="newrequest"&gt; &lt;IgnoreUnresolvedVariables&gt;false&lt;/IgnoreUnresolvedVariables&gt; &lt;/Request&gt;

标签: apigee


【解决方案1】:

很遗憾,我没有足够的声望点来回复之前的评论 - 抱歉...

您应该考虑使用 ServiceCallout 策略来设置所有请求参数,而不是使用 AssignMessage + ServiceCallout。 http://apigee.com/docs/api-services/reference/service-callout-policy#request 解释了这是如何完成的,但要点是您可以将动词、标题等编码为 in ServiceCallout 的一部分。

【讨论】:

    猜你喜欢
    • 2014-09-22
    • 1970-01-01
    • 2020-10-27
    • 1970-01-01
    • 2015-07-06
    • 2015-04-17
    • 1970-01-01
    • 2019-05-28
    • 2015-03-12
    相关资源
    最近更新 更多