Call flow by name

Not applicable

Hi all,

How i can call a flow by name?. For example i have this flow

 <Flow name="chefs">
            <Description/>
            <Request/>
            <Response/>
            <Condition>((proxy.pathsuffix MatchesPath "/getfood/mmexicanfood") ) and  (request.verb = "GET")</Condition>
        </Flow>

but when i try call "chefs" by postmant it is wrong 404 not fount

and if i call with "/getfood/mmexicanfood" it is correct.

How can i call a flow by name but the path are distinct?

Thanks.

Regards

0 4 182
4 REPLIES 4

Hi @Josh iQuyou cannot call a flow by name, but instead you can expand your condition to match both paths

<Flow name="chefs">
            <Description/>
            <Request/>
            <Response/>
            <Condition>((proxy.pathsuffix MatchesPath "/getfood/mmexicanfood") or (proxy.pathsuffix MatchesPath "/chefs") ) and  (request.verb = "GET")</Condition>
        </Flow>

Hope it helps

@Josh iQu

In this case you need to also set the final Path in your target endpoint, you can use a variable when specifying a path such as, (Assuming you are using target servers) and olso you will have to override your target.copy.pathsuffix variable with false:

    <HTTPTargetConnection>
        <LoadBalancer>
            <Server name=">your server name>"/>
        </LoadBalancer>
	<Path>/odata/getfood/mexicanfood</Path>
    </HTTPTargetConnection>

Other wise if not using target servers you can also override variable target.url which is full URL to your target service, you can use either an AssingMessage policy in an target endpoint flow

<AssignMessage ...>
    <AssignVariable>
        <Name>target.url</Name>
        <Value>http://pocres.odata.mx:50000/odata/getfood/mexicanfood</Value>
    </AssignVariable>
</AssignMessage>

It sounds to me that you would like to apply a mapping from inbound url path to outbound URL path.

inbound URL path outbound URL path
/odata/chefs /odata/getfood/mexicanfood

Is that right?

In that case, you want a conditional flow on the ProxyEndpoint to whitelist the /chefs path. And then you want to maybe hard-code specify the /getfood/mexicanfood path in the target url, and also set target.copy.pathsuffix to false in the TargetEndpoint.

The ProxyEndpoint flow will be like this:

   <Flow name="chefs">
       <Description/>
       <Request/>
       <Response/>
       <Condition>(proxy.pathsuffix MatchesPath "/chefs") and (request.verb = "GET")</Condition>
   </Flow><br>

And then your TargetEndpoint should include the /getfood... path, like this:

<TargetEndpoint name="target-1">
    <Description/>
    <FaultRules/>
    <PreFlow name="PreFlow">
        <Request>
          <Step><Name>AM-DisableCopyPathsuffix</Name></Step>
        </Request>
        <Response/>
    </PreFlow>
    <PostFlow name="PostFlow">
        <Request/>
        <Response/>
    </PostFlow>
    <Flows/>
    <HTTPTargetConnection>
        <Properties/>
        <URL>http://pocres.odata.mx:50000/odata/getfood/mexicanfood</URL>
    </HTTPTargetConnection>
</TargetEndpoint>

And the AM-DisableCopyPathSuffix looks like:

<AssignMessage name='AM-DisableCopyPathsuffix'>
    <AssignVariable>
        <Name>target.copy.pathsuffix</Name>
        <Value>false</Value>
    </AssignVariable>
</AssignMessage>