ReST SOAP ReST Verbs Conversion

Not applicable

I have PUT(Update) ReST call sending to PUT service flow in Edge and my Backend call is SOAP Service(POST). I am setting Verb to POST before sending to backend. (Otherwise I get 405 header Error). Now Service executes backend success. But, when return back do I again manually set Verb as PUT in order executes remaining of Response flow ? Is there anyway to avoid setting verb manually on both Request and Response flow ?

Note: I do not have any problem with POST calls. But, GET, PUT, DELETE needs this verb conversion manually. But, I hate assign verbs conditionally using pathsuffix. Can you guide on this to me ?

Solved Solved
1 5 444
1 ACCEPTED SOLUTION

Not applicable

To avoid having to set the verb back on the response flow, you can save the original verb as part of your preflow. You would then use the saved verb in your conditional statements so that you aren't relying on the verb in the request for any of your conditional flows. Here's an example policy for the preflow:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="saveRequestVerb">
    <DisplayName>saveRequestVerb</DisplayName>
    <AssignVariable>
        <Name>originalVerb</Name>
        <Ref>request.verb</Ref>
    </AssignVariable>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>

And an example conditional:

<Condition>originalVerb = "GET"</Condition>

View solution in original post

5 REPLIES 5

Not applicable

To avoid having to set the verb back on the response flow, you can save the original verb as part of your preflow. You would then use the saved verb in your conditional statements so that you aren't relying on the verb in the request for any of your conditional flows. Here's an example policy for the preflow:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="saveRequestVerb">
    <DisplayName>saveRequestVerb</DisplayName>
    <AssignVariable>
        <Name>originalVerb</Name>
        <Ref>request.verb</Ref>
    </AssignVariable>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>

And an example conditional:

<Condition>originalVerb = "GET"</Condition>

@Jessica Glissmann, Thanks for Quick Reply !! After changed the condition in Flow, looks fine. But, there is issue in it. After I changed it, "Proxy Endpoints --> default" list shows wrong like "All" instead of the actual Verb. That makes confuse who look the Service flow in left panel.

From:

<Condition>(proxy.pathsuffix MatchesPath "/{Id}/r/{r-Id}/details") and (request.verb = "PUT")</Condition>

To:

<Condition>(proxy.pathsuffix MatchesPath "/{Id}/r/{r-Id}/details") and (base-Verb = "PUT")</Condition>

How to avoid this confusion ? or Any other option ? What is the best practice Apigee recommended ?

Well !! I have more than 10 GET and PUT services in single Proxy. And also Professionally, change the name like getOrder, putOrder may not look correct when have option of showing Verb. Any other way ? Is this problem in Apigee in general ?

We encountered this too. The solution was to save the request.verb in a variable in the request preflow, as Jessica described, but then also use this variable to restore request.verb back to its original value in the response preflow. That way you can keep request.flow in your conditions, so that it doesn't mess up the verb displays.

To handle that, I would name your flows starting with the verb (e.g. putOrder, getOrder).