4 Replies Latest reply on Nov 9, 2009 1:02 AM by anushree123

    Transform XML to POJO using smooks

    anushree123

      Hello everyone,
      I am working on a POC which involves transforming a XML to POJO and then apply rules on the POJO using Drools.
      this is my action pipeline


















      <route-to destination-name="express" service-category="SecondServiceESB" service-name="SecondJMS"/>
      <route-to destination-name="normal" service-category="ThirdServiceESB" service-name="ThirdJMS"/>









      The xml which I pass gets printed on the console..
      I want to know how to check if it is successfully converted to POJO..
      Any idea about how to go about it??

      Regards,
      Anushree

        • 1. Re: Transform XML to POJO using smooks
          garuda

          Hi Anushree.

          you can generate a HTML report in your SmooksAction, that shows structure of your POJO with values. This is done by an additional property called "reportPath".

          ...
           <action class="org.jboss.soa.esb.actions.smooks.SmooksAction" name="xml2pojosample">
           <property name="smooksConfig" value=".../xml2pojo.xml"/>
           <property name="resultType" value="JAVA"/>
           <property name="javaResultBeanId" value="blahblah"/>
           <property name="reportPath" value="/temp/reports/xml2bean.html"/>
           </action>
          ...


          Regards,

          Dennis

          • 2. Re: Transform XML to POJO using smooks
            anushree123

            Hi,
            Thanks for your reply.
            I did generate the report. But how do I interpret it??
            In result it is showing
            This Smooks Filtering operation produced a JavaResult. The following is an XML serialization of the JavaResult bean Map entries.

            order:
            <com.acme.Order>
            0
            7
            5.2
            </com.acme.Order>

            Does this mean the conversion from XML to POJO is successful??

            Regards,
            Anushree

            • 3. Re: Transform XML to POJO using smooks
              garuda

              At least some kind of values were binded to POJO. The result is the binding you configured in your SmooksTransformation. Whether this is what you really wanted to bind, depends on your SmooksTransformation Logic.

              Br,

              Dennis

              • 4. Re: Transform XML to POJO using smooks
                anushree123

                Hi Dennis,
                Yes this is what I wanted to achieve.
                Thanks for your help, it really helped.

                Regards,
                Anushree