5 Replies Latest reply on Jul 28, 2009 9:55 AM by Fabiano Oss

    ESB 4.6 + csv:listBinding

    Fabiano Oss Newbie

      Hi,

      I'm try to do the tranformation of a csv file to the java class. For this I'm using the smoocks:

      <?xml version="1.0"?>
      <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
       xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.2.xsd" xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd">
      
       <profiles>
       <profile base-profile="source-csv" />
       </profiles>
      
       <csv:reader targetProfile="source-csv" fields="cdclasse,classe,codigo,produto,unidade" separator=";" quote='"'>
       <csv:listBinding beanId="produto" class="mtherm.esb.integracao.Produto"/>
       </csv:reader>
      
      </smooks-resource-list>


      and jbossesb:

      <action class="org.jboss.soa.esb.smooks.SmooksAction" name="transform-from-csv">
       <property name="smooksConfig" value="/cvs.smooks" />
       <property name="messageProfile" value="source-csv" />
       <property name="java-output-location" value="produtos" />
      </action>
      


      But this configuration doesn't work:

      [ActionProcessingPipeline] No fault address defined for fault message! To: JMSEpr [ PortReference < <wsa:Address jms:localhost:1099#queue/canal_esb/>, <wsa:ReferenceProperties jbossesb:java.naming.factory.initial : org.jnp.interfaces.NamingContextFactory/>, <wsa:ReferenceProperties jbossesb:java.naming.provider.url : localhost:1099/>, <wsa:ReferenceProperties jbossesb:java.naming.factory.url.pkgs : org.jnp.interfaces/>, <wsa:ReferenceProperties jbossesb:destination-type : queue/>, <wsa:ReferenceProperties jbossesb:destination-name : queue/canal_esb/>, <wsa:ReferenceProperties jbossesb:specification-version : 1.1/>, <wsa:ReferenceProperties jbossesb:connection-factory : ConnectionFactory/>, <wsa:ReferenceProperties jbossesb:persistent : true/>, <wsa:ReferenceProperties jbossesb:acknowledge-mode : AUTO_ACKNOWLEDGE/>, <wsa:ReferenceProperties jbossesb:transacted : false/>, <wsa:ReferenceProperties jbossesb:type : urn:jboss/esb/epr/type/jms/> > ] MessageID: 49077f28-0376-4e38-8604-1ff923937844 RelatesTo: jms:correlationID#49077f28-0376-4e38-8604-1ff923937844
      


      If I take off the line <csv:listBinding..., my csv file is tranformed in xml file.

      If I execute my smoock in the standalone way, works fine:

       ....
       JavaResult r = new JavaResult();
       smooks.filter(new StreamSource(inputStream), r,execContext);
       ....
      



      I don't known what's problem with my configuration, can someone help me?

        • 1. Re: ESB 4.6 + csv:listBinding
          Daniel Bevenius Master

          Hi,

          If I execute my smoock in the standalone way, works fine:
          Code:

          ....
          JavaResult r = new JavaResult();
          smooks.filter(new StreamSource(inputStream), r,execContext);

          if you are able to run the transformation standalone with Smooks using the above code then try setting the 'resultType' property on the SmooksAction configuration:
          <action class="org.jboss.soa.esb.smooks.SmooksAction" name="transform-from-csv">
           <property name="smooksConfig" value="/cvs.smooks" />
           <property name="messageProfile" value="source-csv" />
           <property name="java-output-location" value="produtos" />
           <property name="resultType" value="JAVA" />
          </action>

          If the 'resultType' property is not specified it defaults to 'STRING'.

          Can you try that and let me know if that works for you?

          Regards,

          /Daniel

          • 2. Re: ESB 4.6 + csv:listBinding
            Fabiano Oss Newbie

            Hello Daniel,

            Unfortunately, this doesn't works. I put 'resultType' in the jboss-esb.xml and show de same error.

            When I run the transformation standalone, my cvs.smooks don't have the attibute 'targetProfile="source-csv"'. If I put show the error:

            Content is not allowed in prolog
            


            Are there some way to show more information for this warning?

             WARN [ActionProcessingPipeline] No fault address defined for fault message! ....
            


            • 3. Re: ESB 4.6 + csv:listBinding
              Tom Fennelly Master

              I don't think "java-output-location" is valid for this action (see the ProgrammersGuide). May have been valid on the deprecated SmooksTransformer action.

              Try something like:

              <action class="org.jboss.soa.esb.smooks.SmooksAction" name="transform-from-csv">
               <property name="smooksConfig" value="/cvs.smooks" />
               <property name="messageProfile" value="source-csv" />
               <property name="resultType" value="JAVA" />
               <property name="set-payload-location" value="produtos" />
              </action>
              


              That should set a Map containing the full Smooks bean context on the message under the key "productos".

              In your case, you may just want the list of Produto objects, in which case you need to explicitly specify that bean (beanId "produto") using the "javaResultBeanId" property....

              <action class="org.jboss.soa.esb.smooks.SmooksAction" name="transform-from-csv">
               <property name="smooksConfig" value="/cvs.smooks" />
               <property name="messageProfile" value="source-csv" />
               <property name="resultType" value="JAVA" />
               <property name="javaResultBeanId" value="produto" />
               <property name="set-payload-location" value="produtos" />
              </action>
              



              • 4. Re: ESB 4.6 + csv:listBinding
                Tom Fennelly Master

                BTW.... based on what you've shown here... there's no real need to use profiles. You're probably not showing the full picture perhaps :)

                • 5. Re: ESB 4.6 + csv:listBinding
                  Fabiano Oss Newbie

                  Now is working fine. I put this configuration:

                  <action class="org.jboss.soa.esb.smooks.SmooksAction" name="transform-from-csv">
                   <property name="smooksConfig" value="/cvs.smooks" />
                   <property name="messageProfile" value="source-csv" />
                   <property name="resultType" value="JAVA" />
                   <property name="javaResultBeanId" value="produto" />
                   <property name="set-payload-location" value="produtos" />
                  </action>
                  


                  thank you!!!