Announcement Announcement Module
Collapse
No announcement yet.
Best remoting choice Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Best remoting choice

    Hi,

    I want to connect to my business logic in many ways - such as remote rich client (java desktop, swing), mobile client, or web client. Could you tell me, how I can meet this demands? Or some helpful materials on the web? Thx in advance.

  • #2
    In principle the choice of middleware should not influence the design of your system. You can expose the same remote interface with different middleware. In Spring (in some cases) it is just a configuration detail.

    Comment


    • #3
      Great! I studied some matetirals and eventually chose hessian remoting (as web service on Tomcat) for my first client - rich desktop client.

      Comment


      • #4
        In my recent tests I found hessian to be quite a good remoting tool but the serializer had some strange problems with my objects to the point I lost my rag with it and went with Spring's HTTP invoker and I've exposed XFire for other languages to interface with my services.

        In some cases I actually found XFire nearly as fast as hessian (it's score was very erratic where SOAP's depended on the client machine's load). RMI & HTTP invoker beat them both for transfering a 32kb byte[] around. The figures were about:
        • Local filesystem (normalising) - 2ms
        • RMI - 6ms
        • HTTP Invoker - 8ms
        • Hessian - 21ms
        • XFire - 28ms

        This was to read the file from disk into a byte[] (using commons-io's IOUtils) & marshal the byte[] over the algorithm to the client. Speed was assessed at the client. All machines were on a local network so I have no idea on how fast/slow these protocols are over distance. The file access is there just to show how long it takes Java to read in the file so you can take 2ms off all the times.

        Comment


        • #5
          I am using RMI with spring,but i meet a problem:how to build session with RMI.

          Comment


          • #6
            Originally posted by greateWei
            I am using RMI with spring,but i meet a problem:how to build session with RMI.
            What do you mean building a session with RMI. Are you refering to RMI with reference to EJBs? In terms of the Spring framework an RMI service is created using:

            Code:
            <bean name="rmiService" class="org.springframework.remoting.rmi.RmiServiceExporter">
            		<property name="service">
            			<ref bean="pojoBeanHere"/>
            		</property>
            		<property name="serviceName">
            			<value>RmiServiceName</value>
            		</property>
            		<property name="pojoServiceInterface">
            			<value>interfaces.PojoServiceInterface</value>
            		</property>
            	</bean>
            This should be enough to export your POJO as an RMI service.

            Comment


            • #7
              Originally posted by andrewyatz
              What do you mean building a session with RMI. Are you refering to RMI with reference to EJBs? In terms of the Spring framework an RMI service is created using:

              Code:
              <bean name="rmiService" class="org.springframework.remoting.rmi.RmiServiceExporter">
              		<property name="service">
              			<ref bean="pojoBeanHere"/>
              		</property>
              		<property name="serviceName">
              			<value>RmiServiceName</value>
              		</property>
              		<property name="pojoServiceInterface">
              			<value>interfaces.PojoServiceInterface</value>
              		</property>
              	</bean>
              This should be enough to export your POJO as an RMI service.
              yes, it is no problem to export RMI service.
              my problem is that how to maintain Session in RMI. for example, after login, the server side maintain user login's information:user's roles etc. when user invoke next RMI request, the server side can recognise which user. the "session" mean is as same as http session.

              thanks.

              Comment


              • #8
                Okay now I get what you mean .

                I haven't had much experience with maintaining concepts like sessions with RMI (I didn't think it actually had the concept of a session). It seems like using the Spring HttpInvoker might be a bit more use since that does work over HTTP (it exposes itself as a Spring MVC component) and will have sessions.

                If you want to remember the user for security reasons then applying ACEGI over the top of your service might be the best way of achiving your goals. Unfortunatly I can't help you any further than that (my services have no concept of security since they run on a closed network).

                Comment


                • #9
                  Acegi to the rescue

                  The acegi class org.acegisecurity.context.rmi.ContextPropagatingRe moteInvocationFactory will take care of session context across a RMI conection. Have a look at the Acegi docos.

                  Comment

                  Working...
                  X