Can Service Callout Policy / be configured using Variables?

cusersn0209705desktoptrace-hardcoded.txtcusersn0209705desktoptrace-dynamic.txtI've been attempting to dynamically configure the URL defined within a Service Callout Policy using variables, however I've been seeing weird behavior. I've read through the documentation here: http://docs.apigee.com/api-services/reference/service-callout-policy#url and it appears as if this should be possible.

I've attempted to configure the URL with two variables, one for domain and another for path, like the documentation.

<URL>https://{test.base}/{test.path}</URL>

However, I receive the following error from the Service Callout Policy when I attempt to submit a request.

404 Not Found: Requested route ('{test.base}') does not exist.

If I hard code the domain portion of the URL this error does not occur.

Edit: Attached trace logs of the request with a hardcoded URL and dynamic URL.

Edit: I'd also like to add that this is an On-Prem implementation of Apigee that is currently using Version 160217

0 6 1,046
6 REPLIES 6

msebai
Participant II

@James Lesniowski can you enable Trace and make sure test.base is correctly set. I just tried following config and worked fine for me.

    <HTTPTargetConnection>
        <Properties/>
        <URL>https://{sc.dom}/{sc.path}</URL>
    </HTTPTargetConnection>

Thanks for the response msebai,

I was able to enable tracing and verify that the test.base variable is correctly set. In fact, I'm able to see that the policy is correctly setting the servicecallout.CallConsumer.target.url variable despite returning a 404 response.

Very hard to guess why at this point, can you pls share further details.. are you seeing this behaviour for specific URL or in general? is it public URL that you can share? can you share offline trace session for both scenarios i.e. dynamic and hardcoded URL?

Absolutely @msebai.

I've attached relevant traces that show a dynamic URL failing and a hardcoded URL succeeding. The URL that I'm testing against is internal, however I have not removed it from the trace so that you can see the variables appear to be set correctly.

The only difference I've been able to identify is that when using variables to set the URL dynamically, the service callout policy also sets the "servicecallout.CallConsumer.target.url" variable.

Thank you for all of your help thus far!

Hey James ,

Were you able to solve this issue ?I am facing similar problems

@Mujahed Sebai I'd also like to point out that this is an On-Prem implementation of Apigee that is currently using version 160217