Results 1 to 6 of 6

Thread: SpringRemoting with HttpInvokerOutboundGateway

  1. #1
    Join Date
    Nov 2009
    Posts
    4

    Default 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. #2
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    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?

  3. #3
    Join Date
    Nov 2009
    Posts
    4

    Default

    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,
    Attached Files Attached Files

  4. #4
    Join Date
    Nov 2009
    Posts
    4

    Default

    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?

  5. #5
    Join Date
    Nov 2009
    Posts
    4

    Default

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

  6. #6
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •