Pratik
Pratik

Reputation: 211

Dynamic address for HTTP inbound endpoint Mule

I am trying to get dynamic address for my http inbound endpoint for SOAP service.

<http:inbound-endpoint exchange-pattern="request-response" address="#[app.registry.appversion.getNewAddress()]" doc:name="HTTP"/>

Spring context has bean definition:

<bean id="appversion" class="com.visit.util.Application">

getNewAddress() in Application class returns a String.

However, it throws exception as:

Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'protocol' threw exception; nested exception is java.lang.IllegalArgumentException: Address '#[app.registry.appversion.getNewAddress()]' for protocol 'http' should start with http://
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1393)
... 38 more

Looks like the MEL is not being evaluated and is treated as a literal String. Am i missing something? Any help appreciated. Thanks in advance.

Upvotes: 0

Views: 118

Answers (1)

David Dossot
David Dossot

Reputation: 33413

Use a Spring Expression (SPeL) instead:

<http:inbound-endpoint exchange-pattern="request-response"
      address="#{appversion.getNewAddress()}" doc:name="HTTP"/>

Upvotes: 2

Related Questions