Skip to content
Advertisement

Getting java.lang.IllegalArgumentException when trying to make a dynamic HTTP endpoint in Mule

I got an HTTP outbound-endpoint that does a GET method to an specific URL, thing is that if i add a variable in the path URL it will throw an exception… i believe this is not being supported. This is my FLOW:

<flow name="ADMIN_GET_GRAPH_DATA" doc:name="ADMIN_GET_GRAPH_DATA">
    <ajax:servlet-inbound-endpoint channel="/admin/get_graph_data" responseTimeout="10000" doc:name="Ajax"/>
    <http:outbound-endpoint exchange-pattern="request-response" host="${graph.url}" port="8081" path="plot/get?graphName=#[json:graph_name]&amp;subgroup=hour&amp;width=100" method="GET" doc:name="HTTP" />
    <byte-array-to-string-transformer doc:name="Byte Array to String"/>
</flow>

This is the exception stacktrace

Caused by: java.lang.IllegalArgumentException:  Endpoint scheme must be compatible with the connector scheme. Connector is: "ajax-servlet", endpoint is "http://specific-url/plot/get?graphName=SPECIFIC_GRAPH_NAME&subgroup=hour&width=100" (java.lang.IllegalArgumentException). Message payload is of type: String
        at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:35)
        at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:43)
        at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)
        at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:93)
        at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)
        at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
        at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)

Tried searching a lot in Google but i got no clue on what’s wrong or what could be done to get it working. I even saw that there were JIRA tickets created in MuleSoft to fix this as it wasn’t “supported” but it was supposed to be fixed after Mule 3.2.1 (I’m using 3.3.1).

The URL is being correctly created, even if you copy-paste it in the browser it will work, but for some misterious reason Mule doesn’t like this.

Thanks.

Advertisement

Answer

Try this:

  • Configure an HTTP connector, say: <http:connector name="httpConnector" />
  • Use it in your dynamic HTTP endpoint: <http:outbound-endpoint connector-ref="httpConnector" ...
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement