Hello!
I've had some problems trying the new rest dsl from camel and I'd like to
know if there is a way to do this:
restConfiguration()
.component("netty-http")
.host("0.0.0.0")
.bindingMode(*RestBindingMode.auto*)
.port("{{server.port}}");
rest("/mail")
.post("/send")
.consumes("text/xml")
.produces("text/xml")
.type(A.class)
.to("direct:msg");
Until here I received a A.class from the clients with no problem.
But from "direct:msg" I'd like to return a (xml) String to the client. Like
this:
from("direct:msg").routeId("direct:msg")
.log("message received: ${body}")
.setBody(new ConstantExpression("<?xml version=\"1.0\"
encoding=\"UTF-8\"?><ok>ok</ok>"));
And than, error:
java.io.IOException: javax.xml.bind.MarshalException
- with linked exception:
[com.sun.istack.SAXException2: unable to marshal type "java.lang.String" as
an element because it is missing an @XmlRootElement annotation]
Look obvious, but I'd like to know if there a way to do this.
Thanks!
Alan Camillo