1 Reply Latest reply on Oct 20, 2009 8:14 AM by sbutt

    how to set more than 1 xsl-params as ESB message property

    sbutt

      Hi Folks,
      I have 2 action classes and in each one I want to set "xsl-params" as message property: e.g.

      The 3rd action is my transformation class.

      <action name="checkSell2" class="com.traveltainment.integra.middleware.h4u.check.CheckSell" process="processPost"/>
      <action name="checkReqTypePost2" class="com.traveltainment.integra.middleware.h4u.check.CheckReqType" process="processPostAgain"/>
      
      <action name="Transform" class="com.traveltainment.integra.middleware.transformer.Transformator">
       <property name="service-template-pool-name" value="H4UService"/>
       <property name="xsl-resources" value="/META-INF/xsl/h4u/ResponseHandlerPackage.xsl"/>
       <property name="template" value="/META-INF/xsl/h4u/ResponseHandlerPackage.xsl"/>
       </action>
      
      


      In CheckSell I have:

      String [][] params = {{"book_response", response}};
       message.getProperties().setProperty("xsl-params", params);
      


      Then in the next action class CheckreqType:
       String [][] params = {{"PkgQuoteBookRQ", message.getBody().get("PkgQuoteBookRQ").toString()}};
       message.getProperties().setProperty("xsl-params", params);
      


      Now when I'm in the xsl transformation, ResponseHandlerPackage and try to access the xslt parameters, like the following:

      <xsl:param name="book_response"/>
       <xsl:variable name="book_responseNode" select="exslt:node-set($book_response)"/>
       <xsl:param name="PkgQuoteBookRQ"/>
       <xsl:variable name="PkgQuoteBookRQNode" select="exslt:node-set($PkgQuoteBookRQ)"/>



      "book_responseNode", is empty. The reason is infact that the preciously set property "book_response" as "xsl-params" inside CheckSell got overwritten in the later "CheckreqType" class.

      So my question is how to set more than 1 xsl-params as message property and access them in the transformation file later?

      Please help.


        • 1. Re: how to set more than 1 xsl-params as ESB message propert
          sbutt

          did it myself:

          String [][] params = (String [][])message.getProperties().getProperty("xsl-params");
           String [][] paramsNew = new String [params.length + 1] [2];
          
           if (params == null)
           {
           message.getProperties().setProperty("xsl-params", new String [] []{{"PkgQuoteBookRQ", message.getBody().get("PkgQuoteBookRQ").toString()}});
           }
           else
           {
           //String [][] paramsNew = new String [params.length + 1] [2];
           for (int i = 0; i < params.length; i ++ )
           {
           paramsNew [0] = params [0];
           paramsNew [1] = params [1];
           }
           paramsNew [params.length] [0] = "PkgQuoteBookRQ";
           paramsNew [params.length] [1] = message.getBody().get("PkgQuoteBookRQ").toString();
           message.getProperties().setProperty("xsl-params", paramsNew);
           }