1 Reply Latest reply on Apr 25, 2012 10:31 AM by steljboss

    How to set passByValue = true in ReplyTo InVMEPR

    steljboss

      I am currently sending an object within a custom location in the Message (lets call it input) and the service I am sending it to is configured as follows (only INVM transport is available)

       

      {code:xml}<service category="MainCategory" name="EntryService" invmScope="GLOBAL">

         <property name="inVMPassByValue" value="true" />

       

         <actions mep="OneWay">

       

            somewhere here I route to another service service-category="ReplyServices" service-name="StatusSetting"

       

         </actions>

       

      </service>

       

      <service category="ReplyServices" name="StatusSetting" invmScope="GLOBAL">

        <property name="inVMPassByValue" value="true" />

       

         <actions mep="RequestResponse">

       

            // I get the object from location "input" without any problems as it has been de-serialized successfully.

             MyObjectClass c = (MyObjectClass) response.getBody().get("input");

             // I enhance the object and put it back in its location

             obj.addStatus("ok");

             response.getBody().add("input", obj);

             //The Message Headers maintain the original ReplyTo and so returns successfully to client

       

       

         </actions>

       

      </service>

       

      {code}

       

      On the client side when I access the object as follows

      {code}MyObjectClassobj = (MyObjectClass) response.getBody().get("input");{code}

       

      I get

       

      {code} ClassCastException org.mypackage.MyObjectClass cannot be cast to org.mypackage.MyObjectClass{code}

       

      This error is similar to the one I was getting before I managed with the service configuration to set the

       

      {code}To: InVMEPR .... <wsa:ReferenceProperties jbossesb:passByValue : true/>  (from default false){code}

       

      Now, I believe the same has to be done for the ReplyTo but

      a) I am not sure how programmatically/configuration

      b) Also am not 100% certain if the cause of the ClassCastException is the fact that the passByValue property is false and therefore I am willing to hear your ideas on this. What other causes could there be?

       

      Thanks in advance

        • 1. Re: How to set passByValue = true in ReplyTo InVMEPR
          steljboss

          Ok it was the passByValue in the ReplyTo that was causing the ClassCastException I resolved it by

           

          removing the "passByValue" extension from the EPR ReplyTo

           

          reply.getAddr().removeExtentions("passByValue", "false")'

           

          and added  a new extension to the same EPR which yields "true"

           

          If there is an easier/less hacking way to do this I would appreciate if anyone can point me to it. By the way this is currently only been identified as an issue for the InVMEpr or my service I haven't tried with JMSEpr or any other as such.