2 Replies Latest reply on Oct 26, 2010 8:47 AM by gvlax

    Problem with Body.get(String) in action process() - always returns null

    gvlax Newbie

      Hi,

       

      For many hours I have been trying to figure out why in the body of the process(Message message) method of my service

      any call message.getBody().get(key) returns always null...

       

      What I do is in my "regular" web service ...PortTypeImpl implementation class I create a message

       

      Message esbReqMessage = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);

       

      then I set an object in it (actually a string) and a body string


      esbReqMessage.getBody().add("key", "strVal");

      esbReqMessage.getBody().add("body");

       

      Then I send the message to an ESB service with a code

       

           ServiceInvoker invoker = new ServiceInvoker(
                  ESB_SERVICE_CATEGORY,
                  ESB_SERVICE_NAME);

           invoker.deliverSync(esbReqMessage, 3000);

       

      Communication between services seems to be OK. Message is accepted by the action.

       

      But when I want to retrieve the "key" object inside the action body - message.getBody().get("key") - I get nothing.

       

      An interesting thing is that message.getBody().get() works OK - the "body" string is returned.

      I even added the

       

         <action class="org.jboss.soa.esb.actions.SystemPrintln" name="println">
           <property name="message" value="[mesage received:]"/>
           <property name="printfull" value="true"/>    
         </action>

       

      action to my service hoping that I would see the "strVal" somewhere in the structure of the message but I could not

      find anything.

       

      I tried also to create the message on the client side with

      Message esbReqMessage = MessageFactory.getInstance().getMessage()

      (no MessageType.JBOSS_XML) by it did not help.

       

      The same with invmScope="GLOBAL" attribute. I played with it with no results.

       

       

      I am using a typical jms configuration for the service:

       

      <providers>
        <jms-provider connection-factory="ConnectionFactory" name="JMSProvider">
         <jms-bus busid="myJMSChannel">
          <jms-message-filter dest-name="queue/myJMSGateway" dest-type="QUEUE"/>
         </jms-bus>
         <jms-bus busid="myESBChannel">
          <jms-message-filter dest-name="queue/myESBAware" dest-type="QUEUE"/>
         </jms-bus>
        </jms-provider>
      </providers>
      <services>
        <service category="MyCategory" description="..." name="MyService">
         <listeners>
          <jms-listener busidref="myJMSChannel" is-gateway="true" name="myJMSGateway"/>
          <jms-listener busidref="myESBChannel" name="myESBAware"/>
         </listeners>
         <actions>

                <action class="MyAction" name="MyProcessingAction">
           </action>

                [...]

       

      Thanks for any ideas.

       

      PS: I am using JBoss AS from the JBoss SOA 4.3 suit.