You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Joachim Geidel <jo...@bluecarat.de> on 2008/02/21 12:18:45 UTC

xstream marshaling produces null result

A friend and I are new to Camel, and we are trying to figure out how it works
and what we can do with it. We ran into a problem when using xstream for
marshaling. We start with XML file input, unmarshal it, change the Java
object, marshal it, and store it in a destination queue. This looks exactly
like one of the Camel test cases, except that the order of marshal/unmarshal
is reversed. However, the message body is null after marshaling.

We have used Camel 1.3.0 from the FUSE download. This is our code, stripped
to the essentials:

----

public class WGRUSRouteBuilder extends SpringRouteBuilder {

        @Override
        public void configure() {

                from("file:data/input?noop=true")
                        .unmarshal().xstream()
                        .process(new Processor() {
                                public void process(Exchange exchange)
throws Exception {
                                        System.out.println("Processor: " +
exchange.getIn());
                                }
                        })
                        .marshal().xstream()
                        .process(new Processor() {
                                public void process(Exchange exchange)
throws Exception {
                                        System.out.println("Processor: " +
exchange.getIn());
                                }
                        
                        })
                        .to("mock:result");
        }
}
----

Unmarshaling creates a Java object as expected, but the second println shows
that marshaling doesn't set the message body to an XML string as we had
expected. Did we miss something, or is it a bug?

Thanks in advance,
Joachim Geidel

-- 
View this message in context: http://www.nabble.com/xstream-marshaling-produces-null-result-tp15607283s22882p15607283.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: xstream marshaling produces null result

Posted by James Strachan <ja...@gmail.com>.
On 21/02/2008, Joachim Geidel <jo...@bluecarat.de> wrote:
>
>  A friend and I are new to Camel, and we are trying to figure out how it works
>  and what we can do with it. We ran into a problem when using xstream for
>  marshaling. We start with XML file input, unmarshal it, change the Java
>  object, marshal it, and store it in a destination queue. This looks exactly
>  like one of the Camel test cases, except that the order of marshal/unmarshal
>  is reversed. However, the message body is null after marshaling.
>
>  We have used Camel 1.3.0 from the FUSE download. This is our code, stripped
>  to the essentials:
>
>  ----
>
>  public class WGRUSRouteBuilder extends SpringRouteBuilder {
>
>         @Override
>         public void configure() {
>
>                 from("file:data/input?noop=true")
>                         .unmarshal().xstream()
>                         .process(new Processor() {
>                                 public void process(Exchange exchange)
>  throws Exception {
>                                         System.out.println("Processor: " +
>  exchange.getIn());
>                                 }
>                         })
>                         .marshal().xstream()
>                         .process(new Processor() {
>                                 public void process(Exchange exchange)
>  throws Exception {
>                                         System.out.println("Processor: " +
>  exchange.getIn());
>                                 }
>
>                         })
>                         .to("mock:result");
>         }
>  }
>  ----
>
>  Unmarshaling creates a Java object as expected, but the second println shows
>  that marshaling doesn't set the message body to an XML string as we had
>  expected. Did we miss something, or is it a bug?

Hmm, maybe its a bug. Any chance you could create a JUnit test case
(or modify one thats already there) that shows the message body
becomes null?


-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com