user1820620
user1820620

Reputation: 702

MuleSoft - using flowVars inside endpoint

I'm starting using Mule and have some trivial questions. Here one of them. Suppose you store the address of a url to invoke later on a process on a property file. Then you want to use an http endpoint specifying this url. It works fine, you simply put in the address: ${URL_ADDRESS} and that's it.

Now if your url is calculated and set on a flowVar, why the following code does not work?

<http:outbound-endpoint exchange-pattern="request-response" method="GET" address="#[flowVars['URL_ADDRESS']]" doc:name="HTTP"/>

It throws this exception:

java.lang.IllegalArgumentException: Address '#[flowVars['URL_ADDRESS']]' for protocol 'http' should start with http://

Why is it checked at compilation time? How can I do to set it at runtime?

Upvotes: 0

Views: 1959

Answers (2)

Ramu Chowdam
Ramu Chowdam

Reputation: 33

you should use the flow variables in below format. Either #[FileName] or #[flowVars.FileName]

Upvotes: 0

Seba
Seba

Reputation: 2319

The protocol cannot be dynamic. You should change your outbound endpoint to
<http:outbound-endpoint exchange-pattern="request-response" method="GET" address="http://#[flowVars['URL_ADDRESS']]" doc:name="HTTP"/>

Upvotes: 4

Related Questions