[mule-user] logging requset and response

2 views
Skip to first unread message

muleby

unread,
Jan 24, 2010, 11:27:45 AM1/24/10
to us...@mule.codehaus.org
Hi All,
I'm new in mule.!images/emoticons/grin.gif!
I have some problem with my component. My wish is logging mule event (endpoint,payload,transformer) on request and response.
I have 2 configuration and 1 java class
the first one: I can run it but i got only log of request
the second one: I use wiretap on inbound-endpoint and I can run it but i got error and not full result
I think, 1) may be it cannot pass payload from wsdl-cxf to vm, 2) my java class is bad (i'm weakest in java T_T)
anyone could help me please, any idea is welcome

*Config #1*

<model name=+"sample"+>


<service name=+"inputService"+>


<inbound>


<inbound-endpoint address=+"stdio://System.in?promptMessage=Enter country or city, separated by a comma:"+


synchronous=+"true"+>


<transformers>


<!-- Convert the input to an object array -->


<custom-transformer class=+"org.mule.transformer.simple.StringToObjectArray"+>


<spring:property name=+"delimiter"+ value=+","+/>


</custom-transformer>


</transformers>


</inbound-endpoint>


</inbound>


<component>


<singleton-object class=+"itone.com.util.Test"+/>


</component>


<outbound>


<chaining-router>


<outbound-endpoint address=+"wsdl-cxf:http://www.webservicex.net/globalweather.asmx?wsdl&method=GetCitiesByCountry"+


synchronous=+"true"+/>


<outbound-endpoint address=+"stdio://System.out"+/>


</chaining-router>


</outbound>


</service>


</model>


</mule>

*Result #1*

Enter country or city, separated by a comma:Singapore


Model =sample


Service =inputService


Message Size =27


PayLoad =


********************************************************************************


* [Ljava.lang.String;@1751a9e *


********************************************************************************


Inbound =stdio://System.in?promptMessage=Enter%20from%20and%20to%20currency%20symbols,%20separated%20by%20a%20comma:


Outbound =http://www.webservicex.net/globalweather.asmx?wsdl&method=GetCitiesByCountry


Jan 24, 2010 11:13:21 PM org.apache.cxf.endpoint.dynamic.DynamicClientFactory outputDebug


INFO: Created classes: net.webservicex.GetCitiesByCountry, net.webservicex.GetCitiesByCountryResponse, net.webservicex.GetWeather, net.webservicex.GetWeatherResponse, net.webservicex.ObjectFactory


Jan 24, 2010 11:13:25 PM org.mule.transport.cxf.transport.MuleUniversalConduit dispatchMuleMessage


INFO: Sending message to http://www.webservicex.net/globalweather.asmx


<NewDataSet>


<Table>


<Country>Singapore</Country>


<City>Singapore / Paya Lebar</City>


</Table>


<Table>


<Country>Singapore</Country>


<City>Singapore / Changi Airport</City>


</Table>


</NewDataSet>


*Config #2*

<model name=+"sample"+>


<service name=+"inputService"+>


<inbound>


<inbound-endpoint address=+"stdio://System.in?promptMessage=Enter country or city, separated by a comma:"+


synchronous=+"true"+>


<transformers>


<!-- Convert the input to an object array -->


<custom-transformer class=+"org.mule.transformer.simple.StringToObjectArray"+>


<spring:property name=+"delimiter"+ value=+","+/>


</custom-transformer>


</transformers>


</inbound-endpoint>


</inbound>


<component>


<singleton-object class=+"itone.com.util.Test"+/>


</component>


<outbound>


<pass-through-router>


<vm:outbound-endpoint path=+"request-channel"+


transformer-refs=+"ObjectToString"+/>


</pass-through-router>


</outbound>


<async-reply>


<vm:inbound-endpoint path=+"back-channel"+ />


<single-async-reply-router />


</async-reply>


</service>



<service name=+"RequestFlow"+>


<inbound>


<vm:inbound-endpoint path=+"request-channel"+/>



<wire-tap-router>


<vm:outbound-endpoint path=+"log-channel"+/>


</wire-tap-router>


</inbound>


<component>


<singleton-object class=+"itone.com.util.Test"+/>


</component>


<outbound>


<chaining-router>


<outbound-endpoint address=+"wsdl-cxf:http://www.webservicex.net/globalweather.asmx?wsdl&method=GetCitiesByCountry"+


synchronous=+"true"+/>


<vm:outbound-endpoint path=+"response-channel"+


transformer-refs=+"ObjectToString"+/>


</chaining-router>


</outbound>


</service>



<service name=+"ResponseFlow"+>


<inbound>


<vm:inbound-endpoint path=+"response-channel"+ />


<wire-tap-router>


<vm:outbound-endpoint path=+"log-channel"+/>


</wire-tap-router>


</inbound>


<component>


<singleton-object class=+"itone.com.util.Test"+/>


</component>


<outbound>


<pass-through-router>


<vm:outbound-endpoint path=+"back-channel"+/>


</pass-through-router>


</outbound>


</service>



<service name=+"LogFlow"+>


<inbound>


<vm:inbound-endpoint path=+"log-channel"+/>


</inbound>


<component>


<singleton-object class=+"itone.com.util.Test"+/>


</component>


<outbound>


<pass-through-router>


<outbound-endpoint address=+"stdio://System.out"+/>


</pass-through-router>


</outbound>


</service>



</model>



<byte-array-to-string-transformer name=+"ObjectToString"+ />



</mule>


*Result #2*

Jan 24, 2010 11:18:13 PM org.apache.cxf.bus.spring.BusApplicationContext getConfigResources


INFO: No cxf.xml configuration file detected, relying on defaults.



Enter country or city, separated by a comma:Singapore


Model =sample


Service =inputService


Message Size =26


PayLoad =


********************************************************************************


* [Ljava.lang.String;@2b2af3 *


********************************************************************************


Inbound =stdio://System.in?promptMessage=Enter%20from%20and%20to%20currency%20symbols,%20separated%20by%20a%20comma:


Outbound =vm://request-channel


Model =sample


Service =RequestFlow


Message Size =11


PayLoad =


********************************************************************************


* {Singapore} *


********************************************************************************


Inbound =vm://request-channel


Outbound =http://www.webservicex.net/globalweather.asmx?wsdl&method=GetCitiesByCountry


Model =sample


Service =LogFlow


Message Size =11


PayLoad =


********************************************************************************


* {Singapore} *


********************************************************************************


Inbound =vm://log-channel


Outbound =stdio://System.out


{Singapore}Jan 24, 2010 11:18:27 PM org.apache.cxf.endpoint.dynamic.DynamicClientFactory outputDebug


INFO: Created classes: net.webservicex.GetCitiesByCountry, net.webservicex.GetCitiesByCountryResponse, net.webservicex.GetWeather, net.webservicex.GetWeatherResponse, net.webservicex.ObjectFactory


Jan 24, 2010 11:18:31 PM org.mule.transport.cxf.transport.MuleUniversalConduit dispatchMuleMessage


INFO: Sending message to http://www.webservicex.net/globalweather.asmx


Model =sample


Service =ResponseFlow


Message Size =14


PayLoad =


********************************************************************************


* <NewDataSet /> *


********************************************************************************


Inbound =vm://response-channel


Outbound =vm://back-channel


Model =sample


Service =LogFlow


Message Size =14


PayLoad =


********************************************************************************


* <NewDataSet /> *


********************************************************************************


Inbound =vm://log-channel


Outbound =stdio://System.out


<NewDataSet />


*Error 2#*


********************************************************************************
Message : Response timed out (10000ms) waiting for message response id "b22878ec-0904-11df-9d33-5d148ac0987d" or this action was interrupted. Failed to route event via endpoint: null. Message payload is of type: String[]
Type : org.mule.api.routing.ResponseTimeoutException
Code : MULE_ERROR-40999
Payload : [Ljava.lang.String;@1e2c9bf
JavaDoc : [http://www.mulesource.org/docs/site/current2/apidocs/org/mule/api/routing/ResponseTimeoutException.html]
********************************************************************************
Exception stack is:
1. Response timed out (10000ms) waiting for message response id "b22878ec-0904-11df-9d33-5d148ac0987d" or this action was interrupted. Failed to route event via endpoint: null. Message payload is of type: String[] (org.mule.api.routing.ResponseTimeoutException)
org.mule.routing.EventCorrelator:500 ([http://www.mulesource.org/docs/site/current2/apidocs/org/mule/api/routing/ResponseTimeoutException.html])
********************************************************************************
Root Exception stack trace:
org.mule.api.routing.ResponseTimeoutException: Response timed out (10000ms) waiting for message response id "b22878ec-0904-11df-9d33-5d148ac0987d" or this action was interrupted. Failed to route event via endpoint: null. Message payload is of type: String[]
at org.mule.routing.EventCorrelator.getResponse(EventCorrelator.java:500)
at org.mule.routing.EventCorrelator.getResponse(EventCorrelator.java:403)
at org.mule.routing.response.AbstractResponseAggregator.getResponse(AbstractResponseAggregator.java:72)
at org.mule.routing.response.DefaultResponseRouterCollection.getResponse(DefaultResponseRouterCollection.java:90)
at org.mule.service.AbstractService.processAsyncReplyRouter(AbstractService.java:922)
at org.mule.model.seda.SedaService.doSend(SedaService.java:259)
at org.mule.service.AbstractService.sendEvent(AbstractService.java:500)
at org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:354)
at org.mule.routing.inbound.DefaultInboundRouterCollection.send(DefaultInboundRouterCollection.java:228)
at org.mule.routing.inbound.DefaultInboundRouterCollection.route(DefaultInboundRouterCollection.java:188)
at org.mule.transport.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:364)
at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:252)
at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:175)
at org.mule.transport.stdio.StdioMessageReceiver.poll(StdioMessageReceiver.java:150)
at org.mule.transport.PollingReceiverWorker.run(PollingReceiverWorker.java:47)
at org.mule.work.WorkerContext.run(WorkerContext.java:310)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
at java.lang.Thread.run(Unknown Source)


********************************************************************************

Test.java

muleby

unread,
Jan 25, 2010, 10:12:00 AM1/25/10
to us...@mule.codehaus.org
please help me T_T

interrupted. Failed to route event via endpoint: null. Message payload is of type: String[]

I think this is cause but i cannot find any Transformers that transform to StringArray

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


David Dossot

unread,
Jan 25, 2010, 3:54:20 PM1/25/10
to us...@mule.codehaus.org
Hi there,

Your first post is really hard to read (formatting issue).

In think you can achieve your goal of custom logging inbound and response messages by:
  • creating a logging service that uses your custom Java logger as a component and is exposed via a VM inbound queue
  • wiretapping the inbound of your main server and chaining the response of its outbound endpoint both towards the VM queue of your logger service.
HTH
D.



muleby

unread,
Jan 25, 2010, 10:36:39 PM1/25/10
to us...@mule.codehaus.org
Hi David,

Thank you for your reply and sorry for bad format that i posted.

I want to log model,service,endpoint and transformer name in to log file, so if I config like your suggestion,
I will get service,endpoint,transformer name of logging service only.
So I put component java class in every service that I cat get model,service,endpoint and transformer name of each service correctly.

*My scenario*
1. If I try with
{color:#0000ff}<stdio:inbound-endpoint system="IN" />
<stdio:outbound-endpoint system="OUT" />{color}
my config can run successfully


2. If I try with
{color:#0000ff}<stdio:inbound-endpoint system="IN" />
<outbound-endpoint address="wsdl-cxf:{color}[{color:#0000ff}http://www.webservicex.net/globalweather.asmx?wsdl&method=GetCitiesByCountry{color}|http://www.webservicex.net/globalweather.asmx?wsdl&method=GetCitiesByCountry]
my config cannot run successfully and show error like I posted.

I dont know why I got error
{color:#ff0000}Message : Response timed out (10000ms) waiting for message


response id "b22878ec-0904-11df-9d33-5d148ac0987d" or this action was
interrupted. Failed to route event via endpoint: null. Message payload is of
type: String[]
Type : org.mule.api.routing.ResponseTimeoutException
Code : MULE_ERROR-40999

{color}
I have 3 muddle are
1. inbound send bad request to webservice??
2. Why I got "Failed to route event via endpoint: null"
3. why I got "Message payload is of type: String[] "

*Thank you in advance*

muleby

unread,
Jan 25, 2010, 11:19:19 PM1/25/10
to us...@mule.codehaus.org
Hi David,
I try again and it's work!! Thank you very much.

*There is my configuration:*

<byte-array-to-string-transformer name="ObjectToString" />

<model name="LogExample">

<service name="WebServiceBridge">
<inbound>
<stdio:inbound-endpoint system="IN" synchronous="true"/>
<wire-tap-router>
<vm:outbound-endpoint path="log-channel"/>


</wire-tap-router>
</inbound>
<component>

<singleton-object class="itone.com.util.Test"/>


</component>
<outbound>
<chaining-router>

<outbound-endpoint address="wsdl-cxf:[http://www.webservicex.net/globalweather.asmx?wsdl&method=GetCitiesByCountry]" synchronous="true"/>
<vm:outbound-endpoint path="log-channel" transformer-refs="ObjectToString"/>


</chaining-router>
</outbound>
</service>


<service name="LogFlow">
<inbound>
<vm:inbound-endpoint path="log-channel"/>
</inbound>
<component>
<singleton-object class="itone.com.util.Test"/>


</component>
<outbound>
<pass-through-router>

<stdio:outbound-endpoint system="OUT" synchronous="true"/>


</pass-through-router>
</outbound>
</service>
</model>

</mule>

Thank again!!

David Dossot

unread,
Jan 25, 2010, 11:44:07 PM1/25/10
to us...@mule.codehaus.org
Sweet stuff, you did great!

D.
Reply all
Reply to author
Forward
0 new messages