1 Reply Latest reply on Sep 9, 2011 7:11 AM by Magesh Bojan

    How to use ServiceInvoker?

    Goro Nog Newbie

      hi

       

      In my project,

      a service is called by using ServiceInvoker.

       

      When a service is called from ServiceInvoker, the service runs second times.

       

      The first calling returns a normal value to the HTTP client.

      And ServiceInvoker puts log in between the first calling and second calling.

       

      I want to call service only once.

       

      Any suggestions would be greatly appreciated.

       

      thanks.

       

      <<infomation>>

      JBossESB Version :jbossesb-server-4.9

       

      Action class source

      public class MyJMSListenerAction extends AbstractActionLifecycle
      {

       

      protected ConfigTree _config;
      public MyJMSListenerAction(ConfigTree config) { _config = config; }

      public Message serviceAuth(Message message) throws Exception{
        
            System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
            System.out.println(" call  : OK");
            message = (new ServiceInvoker("MyCategory", "authOK")).deliverSync(message, 5000);
            System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
            return message;
        }
      }

       

      jbos-esb.xml
      <?xml version="1.0"?>
      <jbossesb parameterReloadSecs="5"
      xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">

       

      <providers>

       

        <jbr-provider name="refProvider" protocol="http">
         <jbr-bus busid="choiceProxyChannel" port="8021"/>
        </jbr-provider>
       
      </providers>

       

      <services>
       
        <service category="MyCategory" description="MyDescription"
         invmScope="GLOBAL" name="choiceProxy">
         <listeners>
          <jbr-listener busidref="choiceProxyChannel" is-gateway="true" name="choiceListener"/>
         </listeners>
         <actions mep="RequestResponse">
        
      <action name="action"
        class="org.jboss.soa.esb.samples.quickstart.helloworld.MyJMSListenerAction"
        process="serviceAuth"
      /> 
          </actions>
        </service>
       
        <service category="MyCategory" description="refDescription"
         invmScope="GLOBAL" name="authOK">
         <actions mep="RequestResponse">
      <action name="action2" class="org.jboss.soa.esb.actions.SystemPrintln">
         <property name="message" value="one time"/>
      </action>
         </actions>
        </service>
      </services>
      </jbossesb>
      HTTP client source

      <html>
      <head>
        <meta http-equiv="Content-Type"
              content="text/html; charset=Windows-31J">
      </head>
      <body>

      <form method="post" action="http://localhost:8021/test/Hello" --> 

        <input type="text" name="number"><br>

        <input type="submit" value="submit">
      </form>

      </body>
      </html>

       

      HttpServlet source

      public void doPost(HttpServletRequest req, HttpServletResponse res)
        throws ServletException, IOException {

        res.setContentType("text/html; charset=EUC-JP");
        req.setCharacterEncoding("EUC-JP");

        PrintWriter out = res.getWriter();

        out.println("i'm called ");

      }

       

      log

      11:48:27,801 INFO  [STDOUT] &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
      11:48:27,801 INFO  [STDOUT]  call  : OK
      11:48:27,832 INFO  [STDOUT] one time:
      11:48:27,832 INFO  [STDOUT] [number=1111].
      11:48:32,832 INFO  [ServiceInvoker] Unresponsive EPR: InVMEpr [ PortReference < <wsa:Address invm://4d7943617465676f7279
      242424242424242424242424617574684f4b/false?false#10000/>, <wsa:ReferenceProperties jbossesb:passByValue : false/>, <wsa:
      ReferenceProperties jbossesb:type : urn:jboss/esb/epr/type/invm/> > ] for message: header: [ To: InVMEpr [ PortReference
      < <wsa:Address invm://4d7943617465676f727924242424242424242424242463686f69636550726f7879/false?false#10000/>, <wsa:Refe
      renceProperties jbossesb:passByValue : false/>, <wsa:ReferenceProperties jbossesb:type : urn:jboss/esb/epr/type/invm/> >
      ] ReplyTo: InVMEpr [ PortReference < <wsa:Address invm://thread-228-6/>, <wsa:ReferenceProperties jbossesb:passByValue
      : false/>, <wsa:ReferenceProperties jbossesb:temporaryEPR : true/> > ] MessageID: 1454ed70-f0b2-4ea0-b55b-744ab766cd10 ]

      11:48:32,879 INFO  [STDOUT] one time:
      11:48:32,879 INFO  [STDOUT] [i'm called
      ].
      11:48:32,879 INFO  [STDOUT] &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&