Re: Xstream marshals to byte array and not String

2012-01-10 Thread Willem Jiang

Can you try this ?

from(activemq:queryServer?exchangePattern=InOut)
.setExchangePattern(ExchangePattern.InOut)

.to(log:it.giammar.pratobackend?showHeaders=true).unmarshal()

.xstream().to(log:it.giammar.pratobackend?showHeaders=true)
.to(bean:saluta)

.to(log:it.giammar.pratobackend?showHeaders=true).marshal()
.xstream(UTF-8).convertTo(String.class).to(log:it.giammar.pratobackend?showHeaders=true);


On 1/9/12 4:33 AM, mgiammarco wrote:

Ok I have tried again and I failed again.

This is my route:

from(activemq:queryServer?exchangePattern=InOut)
.setExchangePattern(ExchangePattern.InOut)

.to(log:it.giammar.pratobackend?showHeaders=true).unmarshal()

.xstream().to(log:it.giammar.pratobackend?showHeaders=true)
.to(bean:saluta)

.to(log:it.giammar.pratobackend?showHeaders=true).marshal()

.xstream(UTF-8).to(log:it.giammar.pratobackend?showHeaders=true);


And this is the log:
[ #1 - JmsConsumer[queryServer]] pratobackend   INFO
Exchange[ExchangePattern:InOut, Headers:{JMSDeliveryMode=1,
JMSDestination=queue://queryServer, JMSType=null, JMSXGroupID=null,
JMSExpiration=0, JMSTimestamp=1326054690900, JMSPriority=4,
JMSRedelivered=false,
JMSMessageID=ID:virtual1.mariosoft.mio-58130-1326054679482-4:1:-1:1:1,
JMSReplyTo=queue:///queue/mia,
breadcrumbId=ID:virtual1.mariosoft.mio-58130-1326054679482-4:1:-1:1:1,
JMSCorrelationID=null}, BodyType:String, Body:?xml version=1.0
?it.giammar.pratomodel.QueryRequestautomaticfalse/automaticquerystomp
stomp/query/it.giammar.pratomodel.QueryRequest]
[ #1 - JmsConsumer[queryServer]] pratobackend   INFO
Exchange[ExchangePattern:InOut, Headers:{JMSReplyTo=queue:///queue/mia,
JMSXGroupID=null, JMSExpiration=0, JMSDestination=queue://queryServer,
JMSCorrelationID=null, JMSType=null, JMSPriority=4, JMSRedelivered=false,
JMSTimestamp=1326054690900,
JMSMessageID=ID:virtual1.mariosoft.mio-58130-1326054679482-4:1:-1:1:1,
breadcrumbId=ID:virtual1.mariosoft.mio-58130-1326054679482-4:1:-1:1:1,
JMSDeliveryMode=1}, BodyType:it.giammar.pratomodel.QueryRequest,
Body:QueryRequest [automatic=false, query=stomp stomp]]
[ #1 - JmsConsumer[queryServer]] Saluta INFO  sono
in sayhello
[ #1 - JmsConsumer[queryServer]] pratobackend   INFO
Exchange[ExchangePattern:InOut, Headers:{JMSXGroupID=null,
JMSDestination=queue://queryServer, JMSType=null, JMSCorrelationID=null,
JMSReplyTo=queue:///queue/mia, JMSRedelivered=false,
breadcrumbId=ID:virtual1.mariosoft.mio-58130-1326054679482-4:1:-1:1:1,
JMSDeliveryMode=1, JMSPriority=4,
JMSMessageID=ID:virtual1.mariosoft.mio-58130-1326054679482-4:1:-1:1:1,
JMSExpiration=0, JMSTimestamp=1326054690900},
BodyType:it.giammar.pratomodel.QueryRequest, Body:QueryRequest
[automatic=true, query=stomp stomp]]
[ #1 - JmsConsumer[queryServer]] pratobackend   INFO
Exchange[ExchangePattern:InOut, Headers:{JMSReplyTo=queue:///queue/mia,
JMSTimestamp=1326054690900, JMSRedelivered=false, JMSDeliveryMode=1,
JMSDestination=queue://queryServer, JMSCorrelationID=null, JMSType=null,
JMSExpiration=0,
breadcrumbId=ID:virtual1.mariosoft.mio-58130-1326054679482-4:1:-1:1:1,
JMSPriority=4,
JMSMessageID=ID:virtual1.mariosoft.mio-58130-1326054679482-4:1:-1:1:1,
JMSXGroupID=null}, BodyType:byte[], Body:?xml version='1.0'
encoding='UTF-8'?it.giammar.pratomodel.QueryRequestautomatictrue/automaticquerystomp
stomp/query/it.giammar.pratomodel.QueryRequest]



--
View this message in context: 
http://camel.465427.n5.nabble.com/Xstream-marshals-to-byte-array-and-not-String-tp5129211p5129934.html
Sent from the Camel - Users mailing list archive at Nabble.com.




--
Willem
--
FuseSource
Web: http://www.fusesource.com
Blog:http://willemjiang.blogspot.com (English)
 http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang


Re: Xstream marshals to byte array and not String

2012-01-10 Thread mgiammarco
Ok I have tried but unfortunately reply is missing. Conversion to String
works:

[ #1 - JmsConsumer[queryServer]] pratobackend   INFO 
Exchange[ExchangePattern:InOut, Headers:{JMSCorrelationID=null,
breadcrumbId=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSPriority=4,
JMSMessageID=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSDeliveryMode=1, JMSReplyTo=queue:///queue/test, JMSRedelivered=false,
JMSTimestamp=1326218785346, JMSXGroupID=null,
JMSDestination=queue://queryServer, JMSType=null, JMSExpiration=0},
BodyType:String, Body:?xml version=1.0
?it.giammar.pratomodel.QueryRequestautomaticfalse/automaticquerystomp
stomp/query/it.giammar.pratomodel.QueryRequest]
[ #1 - JmsConsumer[queryServer]] pratobackend   INFO 
Exchange[ExchangePattern:InOut, Headers:{JMSDestination=queue://queryServer,
JMSXGroupID=null, JMSExpiration=0, JMSPriority=4, JMSCorrelationID=null,
JMSDeliveryMode=1, JMSType=null,
breadcrumbId=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSReplyTo=queue:///queue/test,
JMSMessageID=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSRedelivered=false, JMSTimestamp=1326218785346},
BodyType:it.giammar.pratomodel.QueryRequest, Body:QueryRequest
[automatic=false, query=stomp stomp]]
[ #1 - JmsConsumer[queryServer]] Saluta INFO  sono
in sayhello
[ #1 - JmsConsumer[queryServer]] pratobackend   INFO 
Exchange[ExchangePattern:InOut, Headers:{JMSXGroupID=null,
JMSTimestamp=1326218785346,
breadcrumbId=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSPriority=4,
JMSMessageID=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSExpiration=0, JMSReplyTo=queue:///queue/test,
JMSDestination=queue://queryServer, JMSType=null, JMSCorrelationID=null,
JMSDeliveryMode=1, JMSRedelivered=false},
BodyType:it.giammar.pratomodel.QueryRequest, Body:QueryRequest
[automatic=true, query=stomp stomp]]
[ #1 - JmsConsumer[queryServer]] pratobackend   INFO 
Exchange[ExchangePattern:InOut, Headers:{JMSDeliveryMode=1,
JMSReplyTo=queue:///queue/test,
JMSMessageID=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
breadcrumbId=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSDestination=queue://queryServer, JMSTimestamp=1326218785346,
JMSPriority=4, JMSCorrelationID=null, JMSExpiration=0, JMSRedelivered=false,
JMSType=null, JMSXGroupID=null}, BodyType:byte[], Body:?xml version='1.0'
encoding='UTF-8'?it.giammar.pratomodel.QueryRequestautomatictrue/automaticquerystomp
stomp/query/it.giammar.pratomodel.QueryRequest]
[ #1 - JmsConsumer[queryServer]] pratobackend   INFO 
Exchange[ExchangePattern:InOut,
Headers:{JMSMessageID=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSCorrelationID=null, JMSType=null, JMSDestination=queue://queryServer,
breadcrumbId=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSExpiration=0, JMSPriority=4, JMSTimestamp=1326218785346,
JMSReplyTo=queue:///queue/test, JMSXGroupID=null, JMSRedelivered=false,
JMSDeliveryMode=1}, BodyType:String, Body:?xml version='1.0'
encoding='UTF-8'?it.giammar.pratomodel.QueryRequestautomatictrue/automaticquerystomp
stomp/query/it.giammar.pratomodel.QueryRequest]


--
View this message in context: 
http://camel.465427.n5.nabble.com/Xstream-marshals-to-byte-array-and-not-String-tp5129211p5134795.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Xstream marshals to byte array and not String

2012-01-10 Thread Willem Jiang

How did you send the message to the ActiveMQ?
Please make sure the MEP is InOut.
On Wed Jan 11 02:11:03 2012, mgiammarco wrote:

Ok I have tried but unfortunately reply is missing. Conversion to String
works:

[ #1 - JmsConsumer[queryServer]] pratobackend   INFO
Exchange[ExchangePattern:InOut, Headers:{JMSCorrelationID=null,
breadcrumbId=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSPriority=4,
JMSMessageID=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSDeliveryMode=1, JMSReplyTo=queue:///queue/test, JMSRedelivered=false,
JMSTimestamp=1326218785346, JMSXGroupID=null,
JMSDestination=queue://queryServer, JMSType=null, JMSExpiration=0},
BodyType:String, Body:?xml version=1.0
?it.giammar.pratomodel.QueryRequestautomaticfalse/automaticquerystomp
stomp/query/it.giammar.pratomodel.QueryRequest]
[ #1 - JmsConsumer[queryServer]] pratobackend   INFO
Exchange[ExchangePattern:InOut, Headers:{JMSDestination=queue://queryServer,
JMSXGroupID=null, JMSExpiration=0, JMSPriority=4, JMSCorrelationID=null,
JMSDeliveryMode=1, JMSType=null,
breadcrumbId=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSReplyTo=queue:///queue/test,
JMSMessageID=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSRedelivered=false, JMSTimestamp=1326218785346},
BodyType:it.giammar.pratomodel.QueryRequest, Body:QueryRequest
[automatic=false, query=stomp stomp]]
[ #1 - JmsConsumer[queryServer]] Saluta INFO  sono
in sayhello
[ #1 - JmsConsumer[queryServer]] pratobackend   INFO
Exchange[ExchangePattern:InOut, Headers:{JMSXGroupID=null,
JMSTimestamp=1326218785346,
breadcrumbId=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSPriority=4,
JMSMessageID=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSExpiration=0, JMSReplyTo=queue:///queue/test,
JMSDestination=queue://queryServer, JMSType=null, JMSCorrelationID=null,
JMSDeliveryMode=1, JMSRedelivered=false},
BodyType:it.giammar.pratomodel.QueryRequest, Body:QueryRequest
[automatic=true, query=stomp stomp]]
[ #1 - JmsConsumer[queryServer]] pratobackend   INFO
Exchange[ExchangePattern:InOut, Headers:{JMSDeliveryMode=1,
JMSReplyTo=queue:///queue/test,
JMSMessageID=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
breadcrumbId=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSDestination=queue://queryServer, JMSTimestamp=1326218785346,
JMSPriority=4, JMSCorrelationID=null, JMSExpiration=0, JMSRedelivered=false,
JMSType=null, JMSXGroupID=null}, BodyType:byte[], Body:?xml version='1.0'
encoding='UTF-8'?it.giammar.pratomodel.QueryRequestautomatictrue/automaticquerystomp
stomp/query/it.giammar.pratomodel.QueryRequest]
[ #1 - JmsConsumer[queryServer]] pratobackend   INFO
Exchange[ExchangePattern:InOut,
Headers:{JMSMessageID=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSCorrelationID=null, JMSType=null, JMSDestination=queue://queryServer,
breadcrumbId=ID:virtual1.mariosoft.mio-54532-1326218763414-4:1:-1:1:1,
JMSExpiration=0, JMSPriority=4, JMSTimestamp=1326218785346,
JMSReplyTo=queue:///queue/test, JMSXGroupID=null, JMSRedelivered=false,
JMSDeliveryMode=1}, BodyType:String, Body:?xml version='1.0'
encoding='UTF-8'?it.giammar.pratomodel.QueryRequestautomatictrue/automaticquerystomp
stomp/query/it.giammar.pratomodel.QueryRequest]


--
View this message in context: 
http://camel.465427.n5.nabble.com/Xstream-marshals-to-byte-array-and-not-String-tp5129211p5134795.html
Sent from the Camel - Users mailing list archive at Nabble.com.





--
Willem
--
FuseSource
Web: http://www.fusesource.com
Blog:http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang 
Weibo: willemjiang 



Re: Xstream marshals to byte array and not String

2012-01-09 Thread mgiammarco
I mean does the request reply continue to work if the last step of the route
is not a .to() but a .xstream() ? It seems not for me

--
View this message in context: 
http://camel.465427.n5.nabble.com/Xstream-marshals-to-byte-array-and-not-String-tp5129211p5131281.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Xstream marshals to byte array and not String

2012-01-09 Thread mgiammarco
Nobody can help me? Why after I put xstream marshal/unmarshal request-reply
has stopped working?

2012/1/9 mgiammarco [via Camel] ml-node+s465427n513128...@n5.nabble.com

 I mean does the request reply continue to work if the last step of the
 route is not a .to() but a .xstream() ? It seems not for me

 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://camel.465427.n5.nabble.com/Xstream-marshals-to-byte-array-and-not-String-tp5129211p5131281.html
  To unsubscribe from Xstream marshals to byte array and not String, click
 herehttp://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=5129211code=bWdpYW1tYXJjb0BnbWFpbC5jb218NTEyOTIxMXwtMTIyMTI5ODI4
 .
 NAMLhttp://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespacebreadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml



--
View this message in context: 
http://camel.465427.n5.nabble.com/Xstream-marshals-to-byte-array-and-not-String-tp5129211p5132699.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Xstream marshals to byte array and not String

2012-01-08 Thread mgiammarco
Hello,
I am using a stomp client (that usese only Strings) to send a bean to Camel
using ActiveMQ. It marshal the message to a String using xstream.

Camel receives it as String, it unmarshals (using xstream) it as the correct
Java Bean. Camel process (it is a request-reply queue) and at the end I
marshal it again.

Unfortunately stomp client cannot process the message because xstream in
Camel produce a byte[] array and not a String as output.

Why? how can I force it to use a String?

Thanks,
Mario

--
View this message in context: 
http://camel.465427.n5.nabble.com/Xstream-marshals-to-byte-array-and-not-String-tp5129211p5129211.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Xstream marshals to byte array and not String

2012-01-08 Thread Claus Ibsen
On Sun, Jan 8, 2012 at 1:44 PM, mgiammarco mgiamma...@gmail.com wrote:
 Hello,
 I am using a stomp client (that usese only Strings) to send a bean to Camel
 using ActiveMQ. It marshal the message to a String using xstream.

 Camel receives it as String, it unmarshals (using xstream) it as the correct
 Java Bean. Camel process (it is a request-reply queue) and at the end I
 marshal it again.

 Unfortunately stomp client cannot process the message because xstream in
 Camel produce a byte[] array and not a String as output.

 Why? how can I force it to use a String?


You can always use the .convertBodyTo(String.class) to force a type conversion.

 Thanks,
 Mario

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Xstream-marshals-to-byte-array-and-not-String-tp5129211p5129211.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: Xstream marshals to byte array and not String

2012-01-08 Thread mgiammarco
Thanks I have tried your workaround and it does the conversion.
Unfortunately something worse is happening:

with this route and a String input my stomp client receives a reply:

from(activemq:queryServer?exchangePattern=InOut)
.setExchangePattern(ExchangePattern.InOut)

.to(log:it.giammar.pratobackend?showHeaders=true).unmarshal()

.to(bean:saluta)

.to(log:it.giammar.pratobackend?showHeaders=true);

With the route that I have posted in other reply (I do not repeat here) and
your conversion in String the stomp client does not receive anything.

Unfortunately I am not able to launch a web console to debug camel queues so
I do not understand what is happening. 
The stomp protocol trace shows nothing. 

--
View this message in context: 
http://camel.465427.n5.nabble.com/Xstream-marshals-to-byte-array-and-not-String-tp5129211p5129953.html
Sent from the Camel - Users mailing list archive at Nabble.com.