cancel
Showing results for 
Search instead for 
Did you mean: 

Mule Task calling a external Mule Standalone Server

leohackin
Champ in-the-making
Champ in-the-making
Hi folks,

I'm working in a Activiti + Mule integration using the Mule Task to call the Mule and get back a response.

Today, my architecture is a Tomcat with the Activiti + Mule as a Service and the Mule Standalone running on other server.
After configure the Activiti to work correctly and make the Mule Task works, I managed to send the request with this configs.

Host: http://localhost:8081/sentMuleMessage
Payload: yes
Language: juel
Result Variable: muleResponse

On Mule side, I've create a simple Http Inbound-Outbound that receives an payload with "yes" or "no" value and set the response to "1" or "0" (or "-1" when the input payload are not recognized).

Whatever, the payload is received by Mule as a org.apache.commons.httpclient.ContentLengthInputStream then when transformed using Object to String turns "??tyes". The other problem is to set the payload response: if I don't transform, the Activiti throws a Exception "Failed to read response value". If I do transform the payload using String to Byte Array, the Activiti don't trhows the exception but the muleResponse value is defined with a byte code like [B@696bba80.

Reading other topic (http://forums.activiti.org/content/using-mule-task-send-messages-activiti-mule) Joram said that to communicate through HTTP with Mule I need to use a regular task.

This is true in this new Activiti version yet and this problems that I get is expected? Or have any other ways to make this work?

Thanks a lot for any help.
4 REPLIES 4

trademak
Star Contributor
Star Contributor
What is the payload you are sending to Mule exactly? Is it a Java object? You would need to make sure that the payload is a String to have it sent correctly to Mule and vice versa. We have a couple of simple unit tests available that do exactly this in the activiti-mule module.

Best regards,

leohackin
Champ in-the-making
Champ in-the-making
Hi Tijs,

Glad to hear you. Smiley Wink

Thanks to the unit tests it's works now.

Thank you for the great help.

Regards.

leohackin
Champ in-the-making
Champ in-the-making
Hi again Tijs,

One more help: when I send "yes" on payload expression, no matter what I do in Mule, the results is ??t"yes".
I tried convert using Object-to-String trasformer only, Object-to-Byte-Array transformer followed by Byte-Array-to-String transformer.

The result is always this <code>??t[payload-expression]</code>.

I've tested sending a similar request from other ways and worked.

ON the unit tests, don't have any example of Mule's transformation with the received Activiti data.

Could you help me?

leohackin
Champ in-the-making
Champ in-the-making
Hi Tijs,

I've managed to get the right value from Activiti. Smiley Happy
To achieve this, I've used this sequence of transformers inside Mule:

<code>Object To Byte Array –> Byte Array to Object –> Object to String</code>

I think that it is needed because the Activiti sends a Object instead of a pure String, right?

Anyway, thanks again. Smiley Happy