1 Reply Latest reply: Feb 1, 2012 2:53 PM by 721135 RSS

    How to do service callout with the incoming JMS message in OSB 11g

      Hello All,

      I have a specific requirement for which I am creating a kind of POC where I need some help in OSB, however am new to OSB.

      My Environment:

      1> I have a request queue (deployed on a WLS domain) - WFReq_WS
      2> I have a response queue (deployed on a WLS domain) - WFRes_WS
      3> I have created a ProxyService (request/response type) in OSB 11g which is simply mapping the incoming message in WFReq_WS to WFRes_WS
      4> I have a WebService (it is currently a simple hello WebService for testing) which takes a string and returns the same string with an added 'Hi' in front of it (e.g. If you send Jack, it will return 'Hi Jack')

      My Requirement:

      1> I have to do some mechanism in OSB, by which while mapping the message from WFReq_WS to WFRes_WS (through the proxy service I have), it will pick the JMS message (which will be a string/text) and will make a service callout to the Webservice I mentioned using the message as the input parameter of the WebService.

      2>Now when the response of the WebService will come, OSB should send this response as the message in the response queue (WFRes_WS) I mentioned above.

      To simplify the requirement using an example:

      A> I will send a text/String message (say Jack) to the request queue (WFReq_WS)
      B> OSB should pick the message (Jack) and make a service callout to the webservice
      C> webservice will return 'Hi Jack'
      D> OSB should send this to the response queue (WFRes_WS)

      I know the above might look very basic question to the PROs, but please elaborate (step by step) what need to be done, since I do not know OSB.

      Thanks a lot for your help !
        • 1. Re: How to do service callout with the incoming JMS message in OSB 11g
          Your example points A and D are easily done by having a "Proxy Service" which has the following details:

          Service Type = Messaging Service
          Request and Response type = Text
          Protocol = jms
          Endpoint URI = your request queue (format like 'jms://localhost:7013/weblogic.jms.XAConnectionFactory/QueueJNDIName')
          Checkmark "response" so that the proxy service automatically delivers the response to another queue - your response queue
          Response URI = jms://localhost:7013/weblogic.jms.XAConnectionFactory/QueueResponse

          Now since your "Hello" webservice is (probably) a SOAP xml service you need to "convert" your text based JMS message to xml before sending it on to the "Hello" service.
          Your JMS proxy can do that by just doing a "Assign <whom>{$body/text()}</whom>" to a variable (lets call it 'reqHello')
          Now your JMS proxy should actually call the Hello service and since your JMS proxy is text and the Hello service is SOAP you cannot just "pass" on to the Hello service in a "Route to". Instead you can do a Service Callout where you can specify your "reqHello" variable as payload and a "respHello" as response variable.
          Now you have the "<whom>Hi jack</whom>" in the response variable and since the JMS response needs to be text format you can "extract" the text value into the body variable of the JMS proxy (use "replace /* in body with $respHello/text()" - replace node contents)

          The actual Hello service is a simple "SOAP" based Proxy Service. Add a pipeline and add a stage in the reponse pipeline. Do a ...
          Assign fn:concat("Hi ",$body/whom/text()) to $whomVar
          Replace whom in body with $whomVar (replace node contents)