Problem with response transformers

View: New views
7 Messages — Rating Filter:   Alert me  

Problem with response transformers

by vdegraaff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

I have already posted this question on the "Mule in Action" forum, but I'm hoping to profit from the bigger audience in this mailing list.

I'm an enthusiastic beginner with Mule, but am having a small problem. I'll post my configuration here with only the relevant part of the problem. Sorry about the missing layout, but this does not work (i.e. the 2nd outbound endpoint receives an untransformed response from the first one):

<outbound>
<chaining-router>
<http:outbound-endpoint address="http://localhost:8080/a" synchronous="true">
<response-transformers>
<http:http-response-to-string-transformer/>
<transformer ref="someTransformer"/>
</response-transformers>
</http:outbound-endpoint>
<stdio:outbound-endpoint system="OUT">
<transformers>
<object-to-string-transformer/>
</transformers>
</stdio:outbound-endpoint>
</chaining-router>
</outbound>

However, the following works (note the moved transformer), but this of course is not what I want:

<outbound>
<chaining-router>
<http:outbound-endpoint address="http://localhost:8080/a" synchronous="true">
<response-transformers>
<http:http-response-to-string-transformer/>
</response-transformers>
</http:outbound-endpoint>
<stdio:outbound-endpoint system="OUT">
<transformers>
<transformer ref="someTransformer"/>
<object-to-string-transformer/>
</transformers>
</stdio:outbound-endpoint>
</chaining-router>
</outbound>

I have tried it with a custom transformer, and found out that the response transformer is never called.

What am I doing wrong? Thanks in advance for your help,

Victor de Graaff

Re: Problem with response transformers

by Andrew Perepelytsya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Response transformer is to be applied on the inbound endpoint. In a chaining router you have, naturally, a chain, so one can just put the transformer on the next endpoint. How is that not what you want? Are you trying to achieve something else?

Andrew

Re: Problem with response transformers

by vdegraaff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, this chaining router is just for this example. I have a webservice, which should call several external webservices (through a multicasting-router), aggregate their responses and return this combined response to the caller of the inbound endpoint. Therefore I would like to define a specific response transformer for each of the external endpoints.

The chaining router with the console I only used for testing my configuration for this specific webservice.

Andrew Perepelytsya wrote:
Response transformer is to be applied on the inbound endpoint. In a chaining
router you have, naturally, a chain, so one can just put the transformer on
the next endpoint. How is that not what you want? Are you trying to achieve
something else?

Andrew

Re: Problem with response transformers

by vdegraaff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In addition to my previous post, here is a sequence diagram which illustrates the problem. It is important to realize that all the external webservices have not only their own transport, but also a different XML or SOAP definition, for both requests and responses.

I would like to transform the responses to my canonical model before aggregating the results.


Re: Problem with response transformers

by vdegraaff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

For the work-around for my problem, please visit:

http://www.manning-sandbox.com/thread.jspa?threadID=34663&tstart=0

Re: Problem with response transformers

by andrejk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That is not very intuitive, is there any reason why response transformers do not work on outbound endpoints?

Also, why doesn't mule throw an exception when you define response transformers on an outbound endpoint?

This is something you have to discover by chance, otherwise you'll be debugging for hours without understanding why it doesn't work.

Regards,
Andrej

Andrew Perepelytsya wrote:
Response transformer is to be applied on the inbound endpoint. In a chaining
router you have, naturally, a chain, so one can just put the transformer on
the next endpoint. How is that not what you want? Are you trying to achieve
something else?

Andrew

Re: Problem with response transformers

by andrejk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I did some tests, but response transformers on outbound endpoints seem to work fine: http://www.andrejkoelewijn.com/wp/2009/10/18/response-transformers-on-outbound-endpoints/

Regards,
Andrej

Andrew Perepelytsya wrote:
Response transformer is to be applied on the inbound endpoint. In a chaining
router you have, naturally, a chain, so one can just put the transformer on
the next endpoint. How is that not what you want? Are you trying to achieve
something else?

Andrew