Question

I am new to Mule and trying to post a GET request using the HTTP endpoint, but I am receiving the following error

"Template Endpoint "http://api.mymemory.translated.net:80/get?q=#[message.inboundProperties.get('http.relative.path')]&langpair=EN|IT" resolved into a Malformed endpoint "http://api.mymemory.translated.net:80/get?q=hello&langpair=EN|IT". Failed to route event via endpoint: org.mule.endpoint.DynamicOutboundEndpoint"

I have tried the following configurations:

get?q=hello&langpair=EN%7CIT [WORKS]

get?q=#[message.inboundProperties.get('http.relative.path')]&langpair=EN%7CIT [DOESN'T WORK]

get?q=#[message.inboundProperties.get('http.relative.path')]&langpair=EN|IT [DOESN'T WORK]

The stack trace seems to indicate that there is a problem with the "|" character.

My flow is as follows:

<flow name="my_first_projectFlow1" doc:name="my_first_projectFlow1"> <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/> <http:outbound-endpoint exchange-pattern="request-response" host="api.mymemory.translated.net" port="80" path="get?q=#[message.inboundProperties.get('http.relative.path')]&amp;langpair=EN%7CIT" method="GET" doc:name="HTTP"/> <echo-component doc:name="Echo"/> </flow>

Was it helpful?

Solution

Try replacing the pipe ("|") char with MEL expression #[java.net.URLEncoder.encode('|', 'UTF-8')].

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top