Announcement Announcement Module
Collapse
No announcement yet.
Help Required in Spring Integration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help Required in Spring Integration

    Hi,

    My requirement is to connect to a downstream application with the help of a JAR. We don't have the facility to consume any WS. From the Spring manual i could see the usage of outbound for the WS. Is there a way to connect my Spring app through a client JAR?? Any suggestion would be of great help!!! Is this feasible??


    Thanks in advance,
    Paary
    Last edited by paary; Feb 9th, 2012, 02:11 AM.

  • #2
    Hi adding to the above post, The scenario here is we have exposed a WS in the inbound side but we need to connect to the downstream application through a client jar that takes care of everything like getting connection , uploading the data etc.. Is there a way to integrate that client JAR to our code so that we can be able to connect to the down stream system??

    Thanks,
    Paary
    Last edited by paary; Feb 9th, 2012, 03:54 AM.

    Comment


    • #3
      If I understand you correctly, you have a web service and you want to expose this to a client, but hide the web service details from the client. You can do this with Spring Integration, but you'll need more than one jar on the client.

      First define an interface for the client

      Code:
      public interface ClientSide {
          ResponseType sendAndReceive(RequestType request);
      }
      Code:
      <int:gateway service-interface="foo.ClientSide" request-channel="toWs"/>
      
      <int-ws:outbound gateway request-channel="toWs" .../>
      Use Spring to inject the gateway into the client

      Code:
      ...
      @Autowired
      private ClientSide clientSide;
      ...
      
      ResponseType response = this.clientSide.send(request);
      
      ...

      Comment


      • #4
        Hi Gary,
        Thanks for your time!! Please see below to get a clear understanding of the scenario,
        We are SI based middleware app connecting to various service providers. One of them is enforcing invocation using a client JAR that they provide. This is different from the other invocations we do where we use wsoutbound gateways with approrpirate marshalling technologies in place.

        The Question is: Is there a SI way to connect to webservice which doesnt expose a WSDL but asks to invoke methods on a custom JAR that is provided?


        Thanks,
        Paary
        Last edited by paary; Feb 10th, 2012, 01:44 AM.

        Comment


        • #5
          Ahh... I see, so your app is the client in this case.

          Yes, you would use a <service-activator /> for this. The exact mechanism depends on how friendly their API is. If it's just a simple class...

          Code:
          public class ClientSide {
              ResponseType call(RequestType request) {...}
          }
          You can just reference it as a bean and send a message with a 'RequestType' payload and you will get back a message with a 'ResponseType' payload.

          Code:
          <int:service activator input-channel="in" output-channel="out" method="call">
              <bean class="foo.ClientSide"/>
          </int:service-activator>
          Don't forget SpEL either; if their API is, say...

          Code:
          public Order getOrder(String customer, String orderNumber) {...}
          ...you can use...

          Code:
          <bean id="client" class="foo.ClientSide"/>
          
          <int-service-activator ... expression="@client.getOrder('payload.customer', 'payload.orderNumber')" />
          If their API is more complicated, you may need to wrap it in a simpler class, and expose that via the <service-activator/>, but there are many other options too (e.g. <int-groovy:script/>). The key is to look at their API and figure out the simplest way to call it, with the least amount of custom code - hopefully none.



          Hope that helps.

          Comment

          Working...
          X