Announcement Announcement Module
Collapse
No announcement yet.
SpringRemoting with HttpInvokerOutboundGateway Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SpringRemoting with HttpInvokerOutboundGateway

    Hi,

    I've a repository from which I need to get some information(both uses Spring FW).
    Now I want to do a SpringRemoting and execute a method in that and I am looking to use SpringIntegration for that with the HttpInvokerOutboundGateway.

    But I've not been able to figure out how do i execute the remote object.

    Any pointers would be useful.

  • #2
    As far as executing remote object i would suggest to read up on Spring Remoting in general since Spring Integration is built on top of Spring.

    http://static.springsource.org/sprin.../remoting.html

    In the future please provide more information. Based on this post it seem to me you are looking for a general explanation and example which is available in Spring Reference Manual (see above)

    As far as HttpInvoker support in Spring Integration, it is being deprecated in favor of REST support provided by HTTP module which uses Spring's RestTemplate. HttpInvoker will be completely removed in the next version. What kind of repository you are talking about?

    Comment


    • #3
      Hi Oleg,

      App1 interacts with App2 using HttpInvokerProxyFactoryBean, so a remore service in App2 is currently called from App1.

      Now I'm trying to introduce Content Based Routing in App1 using SpringIntegration, so the request goes to a specific Instance of App2. The actual call to App2 will have to be through a remote service, so I was hoping to use the HttpInvoker.

      I've attached a jpg(within the zip, not able to upload the jpg) explaining what I'm trying to do.

      note: I cannot make any changes to App2.

      -Regards,

      Comment


      • #4
        I hope this brings more clarity:

        App2 remote method:
        public class RemoteObject implements IRemoteObject{

        public IResponse execute(){

        // do something
        }
        }


        App1 Present conf:

        <bean id="httpInvokerProxy"
        class="AppProxyFactoryBean">
        <property name="serviceInterface"
        value="IRemoteObject" />
        <property name="serviceUrl" value="default" />
        </bean>

        and in the java code:

        public class App2Adapter{
        public IResponse execute(){
        IRemoteObject controller = (IRemoteObject) factory.create("AppProxyFactoryBean", "");
        response = (IResponse) controller.execute(request); // this invokes the execute in RemoteObject
        }
        }

        public AppProxyFactoryBean extends HttpInvokerProxyFactoryBean implements BeanNameAware {
        String url = "http://..."
        public Object invoke(MethodInvocation method) throws Throwable {
        super.setServiceUrl(url);
        return super.invoke(method);
        }
        }

        Now I'm introducing SpringIntegration at App1, to chose the URL based on the request. And I want to execute that request remotely in App2.
        How do I do that?

        Comment


        • #5
          Is routing+remoting not possible with Spring Integration or am I asking the wrong question?

          Comment


          • #6
            Of course its possible

            All I am saying is that based on your explanation APP2 is just a web app which exposes a Controller which you were planning to invoke via Http Invoker.

            A better way is to invoke it via Http Outbound Gateway instead of deprecated Http Invoker. Check out our samples, there is an example called multipart-http which has both HTTP inbound and outbound adapter.

            And then you can have transformers,routers etc., on either side.

            Comment

            Working...
            X