1 Reply Latest reply on Feb 6, 2012 10:34 PM by ffang

    Data format when writing Camel transforms?

    nigelgay

      Hi,

       

      I'm trying to build something where I have:

      1) A web service BC which passes requests to the NMR

      2) A camel route which examines/alters the payload and passes it onto an SE that is installed in the NMR

      3) A SE containing the service implementation.

       

      Initially its a proof of concept but doing it like this because this is the structure we expect our real project will have - not a direct 1:1 relationship between the BC + SE web services.

       

      I've based what I've got so far on the cxf-wsdl-first-osgi-package and cxf-camel-nmr examples plus other responses I've read on this + other forums.  I have the BC, SE and route defined in 3 separate projects/OSGi bundles.  So far I have the BC defined with

       

       

       

      I can successfully make calls to the BC, and see the "transform" method being called, set some output, and can see the ESB attempting to invoke the SE.  (See * below)

       

      My question is what format can/should I use for the input+output of the "transform" method?  Transform is just defined as public Object transform(Object body); if I check the actual class of the input I'm being passed, its a org.apache.servicemix.nmr.core.util.StringSource.

       

      I can do .toString() on it, and get at the contents of the message as a long string of XML, but really that's not very useful, I was hoping if put wsdl2java in my maven build to generate all the code stubs, that the ESB would handle all the JAXB converting the text into POJOs and what my "transform" method would receive would be a PingRequest object, and likewise that I could output from "transform" the POJO that nmr:Ping has as its input.

       

      Is there a better way to set up the BC and route so you get a more useful data format coming into the transform method, or any other suggestions that would avoid me having to parse/manipulate the web service request as raw XML?

       

      (*) so what I'm seeing happen is the ESB attempting to call my SE, but at that point it falls over complaining that the data format I'm outputting out of my "transform" method into the SE is incorrect.

       

      Many thanks!

      Nigel.