2 Replies Latest reply on Apr 11, 2011 7:23 AM by shwetanks

    Need to Transform input request parameters to XML using smooks.?

    shwetanks

      Hi All,

       

      As per the requirement I need to generate an XML from some input request parameter. But I have no idea how to populate data in java object  to xml tag values using smooks-config.xml.

       

      From XML to Java I have done...but now the case is opposite.

       

      I have already gone through the link http://community.jboss.org/thread/146312 but couldn't cater to my requirement.

       

      Please let me know if it is actually possible using smooks configuration.

       

      Any sort of help is highly appreciated.

       

      Thanks & Regards,

      Shwetank

        • 1. Need to Transform input request parameters to XML using smooks.?
          tfennelly

          Check out the smooks user guide and examples at smooks.com.  You could also implement a simple FreeMarker action that applies a FreeMarker template to your Java object model.

          • 2. Need to Transform input request parameters to XML using smooks.?
            shwetanks

            Hi Tom,

             

            Thanks for your quick reply.

             

            I got your point that you are saying something like

             

             

            <![CDATA[<line-item>

               <product><xsl:value-of select="./Product/@productId" /></product>

               <price><xsl:value-of select="./Product/@price" /></price>

                <quantity><xsl:value-of select="@quantity" /></quantity>

            </line-item>]]>

             

            But my input is not an XML, it is a post request with say 3 parameters param1,param2 and param3

            So the request would come like

             

            http://localhost:8080/http?param1=value1&param2=value2&param3=value3

             

            Now I want to transfer it like

             

            <request>

            <param1>value1</param1>

            <param2>value2</param2>

            <param3>value3</param3>

            </request>

             

             

            I can implement it using custom java code, but I wanted to give it a try using Smooks.

             

            So, is it possible using smooks configurations.

             

            One more questions,

            I googled for FreeMarker action you have mentioned above, but couldn't found any. Can you please share some more details over that?

             

            Thanks & Regards,

            Shwetank