Mule School: Invoking component methods using Entry Point Resolvers

April 24 2012

4 comments 0

In the previous lesson Invoking Java Component Over HTTP, we learned how to invoke a simple method of a Java component in Mule Flow. Let’s now go a bit further and see how Mule maps a request message to a specific method in your component using Entry Point Resolvers.

At a high level, Mule uses three types of Entry Point Resolvers.

  1. Reflection Entry Point Resolver
  2. Annotated Entry Point Resolver
  3. Callable interface

In this article, I will focus on the Reflection Entry Point Resolver, which is used to determine the entry point on a component after a message has been received. The entry point is discovered using the message payload type(s) as the argument using reflection. For multiple parameters the payload should be an Array of objects. If the message payload is of type NullPayload the resolver will look for a no-argument method.

Creating Java Component

Let us now use the following Java class to learn how the Reflection Entry Point Resolver works.

RelectionEntryPointResolverExample contains three methods:

  • multipleArgumentsMethod – takes in two String arguments. We will need to pass an array of String[] elements to invoke this method. We will see in the next steps how this can be done.
  • singleArgumentMethod – takes in one String argument. This method will be invoked when the request payload contains a single String.
  • noArgumentMethod – has no arguments. We need to ensure the request payload is null to invoke this method.


Building a Mule Flow

Let us build this flow in Mule Studio now. This flow will receive two request parameters: name and dept. These parameters will be transformed in such a way that each of the methods in class are invoked.

As explained in Invoking Java Component Over HTTP, create the “learningmule” Mule Project followed by a “java” Mule Flow. Create an Inbound HTTP endpoint listening on port 8081 and path “java”.

Drag and drop an Expression Transformer from the component palette next to the HTTP Inbound Endpoint, as shown below. We will use an Expression Transformer to transform request parameter values to an Array of Strings. For example, the HTTP GET query string {name=Amjad&dept=Services} will be transformed to an array of two Strings: [“Amjad”, “Services”]. More details on Mule Transformers can be read here:


Double-click on the “Expression” icon in the Flow to open the Expression properties dialog. Navigate to the “Advanced” tab.


Click the (+) icon under “Return Arguments” section to add “header” as evaluator and “inbound:name” as Expression. Similarly, add another return argument for “inbound:dept” parameter.


Request parameters by default are stored in an implicit “header” object under “inbound” scope. More details on Expressions can be read here:

The resulting flow code looks like this:


Drag and drop a Java component next to “Expression Transformer and point the singleton object class to “”, which we created earlier. Drag and drop an echo component next to it. The resulting flow looks like this:


The Mule flow now looks like this:


When we run the Mule Flow, we should be able to see the request entry point being resolved to multipleArgumentsMethod. We will confirm that very soon.

Similarly, lets create another Expression Transformer with just one return argument “inbound:name”, followed by Java and Echo components. It will be easier to copy and paste the code. The resulting code looks like this:


Finally, let’s use another Expression Transformer to create a null payload. We will use the Groovy expression evaluator to do this, as shown below:


The completed Mule flow is shown below:


Executing Mule Flow

Run the “java” flow as a Mule Application and access the following URL:


Observe the output in Mule Studio in the “Console” tab. We can see each of the three methods invoked when appropriate arguments are received.

We'd love to hear your opinion on this post

4 Responses to “Mule School: Invoking component methods using Entry Point Resolvers”

  1. Dear Amjad,

    It seems this article does not work in MuleStudio-CE-for-win-64bit-1.3.1.
    The error occurs when running Mule Application.

    WARN 2012-09-25 05:41:00,431 [main] org.mule.config.spring.parsers.assembly.DefaultBeanAssembler: Cannot assign class java.lang.Object to interface org.mule.api.AnnotatedObject
    ERROR 2012-09-25 05:41:00,477 [main] org.mule.module.launcher.application.DefaultMuleApplication: null
    org.mule.config.spring.parsers.processors.CheckExclusiveAttributesAndChildren$CheckExclusiveAttributesAndChildrenException: Element expression-transformer{name=Expression, expression=QueryString} can’t contain child return-argument because it defines attribute expression
    at org.mule.config.spring.parsers.processors.CheckExclusiveAttributesAndChildren.checkAttributeNameMatch(

  2. Do not worry, it seems to be a bug with Studio. You just run the above example with errors, it will run.

  3. Hi Amjad Mogal,
    In latest version of Mule ESB, Expression Attribute for this Expression Transformer is mandatory, so, i treid with

    and it throws exception, on name=”Expression” expression=”#[header:*]”> , so what could be the exact “expression=” for this, program, kindly assist

  4. Hi Amjad,
    I just want to know how to I modify my message payload with java transformer