Monday, May 11, 2015

Creating a loopback service on MPG

As we already learned what is MultiProtocol gateway in datapowerfresher.blogspot.com/2013/04/creating-multiprotocal-gateway.html.Lets see how to create a sample loop back service.

Scenario: The below example is MPGW is acting like a backend to the WSP which is the front end for the client. The client will make a SOAP call to WSP http handler and the request is routed to MPGW where requested has been processed and gives out a static reply or just a loopback of the request.

Once we have done the basic configurations for WSP and MPGW like request, response types, Processing policy,XML manager,http or https or any fsh handlers etc.

MPGW configurations:
 As MPG itself acting as backend and it is not calling any other server or object the backend option in MPG would be dynamic backend.

Steps:
  • Select Dynamic Backend option on mpg
  • Open Processing policy and create a request rule
  • Use the appropriate actions to process the request like transform for any xpath validations
  • Before result action,drag and drop the advanced action 
  • Open the advanced action and select the set variable option
  • For variable name click on var builder and service variable select the var://service/mpgw/skip-backside

  • Variable assignment can be given as 1
  • Apply policy

When MPG receives a request it will match the match rule in request rule and do the modifications specified in transform action and it will skip the backside connection and loop back the output context of previous action.

This is the test to check the MPG is working with the allowed configurations or not.


9 comments:

  1. Hi Sri..your posts are very clear and helpful. Can you please help with dynamic routing in datapower.I'm trying to call a web service proxy of type dynamic and trying to call that service from an MPGW through an XSLT but it's returning the below response.




    env:Client
    Internal Error




    Your help on this will be appreciated.

    ReplyDelete

  2. In stead of URL you out your wsp URL to route it from MPG and xsl.
    Client error mostly occurs the uri mismatch on destination object or you may forgot to add in match actio.Check match rule and confirm

    ReplyDelete
  3. dp: set-variable name="'var://service/routing-url'" value="'url'"

    ReplyDelete
  4. Hi. Thanks for the blog. Very crisp and clear. I needed your help to solve a problem I am facing with my MPG implementation.
    I have made the request MPG with dynamic backend. After transformations set the "var://service/routing-url" with the server url. After this I need to prepare the response back to the client. So I added a transformation step to create the response, but I am unable to send the response back to the client. The server recives the request correctly. Could you kindly help. Thanks.

    ReplyDelete
    Replies
    1. Are you trying to build static response back or you want to transform response from server to xml or any other format to client?
      When you use routing variable response goes to the response rule.
      Create a response rule and put your transformation action there.let me know if it helps

      Delete
    2. Thanks for replying. I need to send a static response back to the client. Like a "Success" message.

      Delete
  5. Hi MPG as loopback We are using the value=1 but in that place 0 or 2 and any value except 1 we are using any exception/blockers are coming.
    Can you tell me very clear answer.

    If im using the 0 also its coming the same response.

    ReplyDelete