When does Response flow of a conditional flow get executed?

Hi,

I have added a javascript policy in the response flow of a conditional flow in proxy endpoints. But this not being executed. The condition is returning false. However same condition returned true in the request flow.

This is soap to rest conversion proxy. Do i need to change the HTTP verbs in the response flow after target post flow is executed?

4242-capture.png

Thanks,

Krish

Solved Solved
1 10 1,093
1 ACCEPTED SOLUTION

Hi Krish,

If the condition is returning false, its likely the request.verb is no longer set to GET so the policy does not execute in the response flow. If you've changed the Verb to POST while sending the payload to the target, this is most likely the case.

In order to execute the policy, you would need to save the request.verb in a flow variable say requestVerb for this flow and then use that variable in the condition in the response flow instead of the system variable request.verb.

View solution in original post

10 REPLIES 10

Hi Krish,

If the condition is returning false, its likely the request.verb is no longer set to GET so the policy does not execute in the response flow. If you've changed the Verb to POST while sending the payload to the target, this is most likely the case.

In order to execute the policy, you would need to save the request.verb in a flow variable say requestVerb for this flow and then use that variable in the condition in the response flow instead of the system variable request.verb.

Thanks @Hansel Miranda for your reply. Yes I changed the method type to POST for the soap target.I will change it back to GET. This is an additional steps for SOAP to REST conversion where the method type is GET. Can apigee make change to incorporate this additional step in WDSL import wizard? Just a thought.

Good suggestion!

I would advise that you do not "change it back to GET". Instead store the original verb in the preflow, then modify the Condition on the flow to test the stored condition.

Just my preference.

@Krish , You haven't mentioned what exactly is the condition you are using ?

(proxy.pathsuffix MatchesPath "/pnrtrips") and (request.verb = "GET")

@Krish , See the @Hansel Miranda answer below, That should solve your issue. Set a variable called "requestVerb" in request flow before you convert the verb to POST & then use the "requestVerb" custom variable instead of request.verb in your condition.

@Anil Sagar I understand this. Shouldn't apigee add the step in the current template it provides for converting SOAP to REST using wsdl import?

@Krish , Ideally yes, We encourage people to use the proxy editor instead of depending on the wizard. Actually, We use the local editor to develop proxies using xml instead of using the configuration UI. Developers loves coding 😉

Not applicable

your verb has been propberly been changed before your condition is excuted. you can save the verb in your own variable and use it later.

Not applicable

@Krish If your javascript policy is in the Conditional Flow, you don't need to put the same condition in the <step>, what if you remove the condition in that <step> or remove request.verb=GET in the condition?