mulemule-studiomule-componentmule-cluster

Using MEL to fetch URL in HTTP OUTBOUND ENDPOINT


I have an requirement where I have to consume an rest service over HTTPS and I have to fetch the URL in runtime . To accomplish the same I am setting the REST 'url' as a outbound property and I am trying to fetch that using MEL

#[message.outboundProperties.'url'

When try to do as I said above , I am getting compile time error which is mentioned below

org.springframework.beans.MethodInvocationException: Property 'protocol' threw exception; nested exception is java.lang.IllegalArgumentException: Address '#[message.outboundProperties.'url']' for protocol 'http' should start with http://

Am I doing anything wrong ? or is there a best way to achieve this requirement other than this ?

	<https:outbound-endpoint exchange-pattern="request-response"
							  method="GET" doc:name="HTTPs with Auth header" address="#[message.outboundProperties.'url']" connector-ref="HTTP_HTTPS"/>

    <https:connector name="HTTP_HTTPS" cookieSpec="netscape" validateConnections="true" sendBufferSize="0" receiveBufferSize="0" receiveBacklog="0" clientSoTimeout="10000" serverSoTimeout="10000" socketSoLinger="0" doc:name="HTTP-HTTPS">
        <https:tls-key-store path="#[message.outboundProperties.'Storepath']" keyPassword="#[message.outboundProperties.'storepassword']" storePassword="#[message.outboundProperties.'storepassword']"/>
        <https:tls-server path="#[message.outboundProperties.'Storepath']" storePassword="#[message.outboundProperties.'storepassword']"/>
    </https:connector>


Solution

  • Http components requires a static 'HTTP://' as the beginning of the URL hence the below works

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