1 Reply Latest reply on Aug 11, 2010 7:20 AM by M -

    EJBProcessor with primitive arguments

    M - Newbie

      Here's a stupid question. I need to call EJB method with two arguments. The other one is an object and the other argument is primitive type of int. How should I configure ejb-params -property?

       

      ----------------------------------------------------------------------

      <action class="org.jboss.soa.esb.actions.EJBProcessor" name="GetTheThingEJBProcessor">

           <property name="ejb3" value="false"/>

           <property name="ejb-name" value="SomeService"/>

           <property name="jndi-name" value="ejb. SomeServiceRemoteHome"/>

           <property name="initial-context-factory" value="weblogic.jndi.WLInitialContextFactory"/>

           <property name="provider-url" value="t3://xxxxxxx:xxxx"/>

           <property name="method" value="getTheThing"/>

           <property name="esb-out-var" value="GetTheThingEJBresponse"/>

           <property name="ejb-params">

            <arg0 type="somepackage.model.SomeObject">a</arg0>

            <arg1 type="and here I should put primitive data type int?">b</arg1>

           </property>

      </action>

      ----------------------------------------------------------------------

      This is to call EJB method getTheThing(SomeObject blaa, int id)


      I'm using AS 5.1 and ESB 4.8.

        • 1. Re: EJBProcessor with primitive arguments
          M - Newbie

          I resolved the problem by making a dirty hack to EJBProcessor.

           

          In process() I'm doing this:

          for (int i = 0; i < ejbParams.size(); i++) {
                          // get the parameter from the esb message and
                          // cast it to the in the jboss-esb.xml specified type
                          type = ejbParams.get(i).getType();
                          obj = msg.getBody().get(ejbParams.get(i).getLoc());
           
                          // slight int hack part 1                
                          if (type.equals("int")) {
                              param[i] = Integer.parseInt(obj.toString()); 
                          } else {
                              param[i] = ClassUtil.forName(type, getClass()).cast(obj);
                          }
           
                          log.debug("param " + i + ":" + param[i]);
                      }
          
          

          ...and in invoke() this:

           

          for (int i = 0; i < ejbParams.size(); i++) {
                      type = ejbParams.get(i).getType();
                      // slight int hack part 2
                      if (type.equals("int")) {
                          sigArray[i] = int.class;
                      } else {
                          sigArray[i] = ClassUtil.forName(type, getClass());
                      }
                  }
          

           

          It's dirty but it works in this case.