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

      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.

        • 1. Re: Problem with Body.get(String) in action process() - always returns null
          tfennelly

          Try hooking up a debugger and look at the contents of the message body.  Sounds like the body part in question is being removed somehow.  Are you using a name that might be clashing with something else?  Try changing the name to something really obscure.

          • 2. Re: Problem with Body.get(String) in action process() - always returns null
            gvlax

            The names were simplified - just to describe the problem - I am using my own package prefixes for keys.

            I tried many options - but each time the attributes get lost..

             

            I wonder if it may be caused by a fact that my code (ESB and web service) is being deployed by eclipse somewhere inside of its workspace (different VM) and the web service is working on JBOSS. Maybe the invm communication does not work as expected ... I don't know. I have to do some more experiments.