Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
9 replies Latest Post - ‏2013-02-21T19:34:50Z by HermannSW
jaluecht
jaluecht
29 Posts
ACCEPTED ANSWER

Pinned topic Processing http post/get requests

‏2013-02-15T16:56:06Z |
I have run some searches in this forum for running processing http post/get requests.

There is not a lot of recent information. I'm asking to see if there is anything new on this topic.

Can DataPower process http get/post bindings in a web service proxy?

Can DataPower process RESTful or REST-like requests.
Updated on 2013-02-21T19:34:50Z at 2013-02-21T19:34:50Z by HermannSW
  • kenhygh
    kenhygh
    1461 Posts
    ACCEPTED ANSWER

    Re: Processing http post/get requests

    ‏2013-02-16T12:39:42Z  in response to jaluecht
    I've never done it in a WSP, I usually us a MPGW for handling RESTful services. Maybe someone else here has used a WSP.

    Ken
    • jaluecht
      jaluecht
      29 Posts
      ACCEPTED ANSWER

      Re: Processing http post/get requests

      ‏2013-02-16T17:47:02Z  in response to kenhygh
      I have done some research and found a sample for using MPG. If anyone has done this, could they let me know how they did it.

      Jeff
  • JBrennan
    JBrennan
    77 Posts
    ACCEPTED ANSWER

    Re: Processing http post/get requests

    ‏2013-02-18T14:19:42Z  in response to jaluecht
    WHen you say HTTP post, I am assuming you are referring to a form post and not XML. In this case, you must do the following. I am not sure about doing this in a WSP and reslly do know why you would want to. If you do have a valid reason, I would try the same as you would with a MPGW which are as follows.

    1. Enable the GET method on the HTTP(s) FSH object.
    2. Make the service a non-xml request type (or you can mark the rule as non-xml only)
    3. In the request rule, make your first action a "COnvert Query params to XML" which can be found within the advanced action set.
    4. The convert query params to xml action will convert all query params and form fields to a well formed xml document which you can handle any way you would like in a stylesheet in sunsequent actions.

    I hope this helps.
    • jaluecht
      jaluecht
      29 Posts
      ACCEPTED ANSWER

      Re: Processing http post/get requests

      ‏2013-02-20T14:05:18Z  in response to JBrennan
      Thanks for your response. I got it working.

      I need to give a little background on this next question.

      The service I am building the DataPower configuration for contains three bindings - HTTP Get, HTTP Post & SOAP.

      The requests for this particular part of the system com from mobile devices and will be HTTP Post requests (standard post body text - no xml/json).

      I see how you can take an inboung post request and convert it to xml parameters.

      I would prefer to avoid converting the incoming post request to a SOAP call.

      This may seem like a very dumb question - but - is there anyway to convert the xml parameters back to a standard post body (paraname1-paravalue1&paraname2=paravalue2...) inside DataPower?
      • HermannSW
        HermannSW
        4490 Posts
        ACCEPTED ANSWER

        Re: Processing http post/get requests

        ‏2013-02-20T16:20:26Z  in response to jaluecht
        Hi Jeff,

        > This may seem like a very dumb question - but - is there anyway to convert the xml parameters back to a standard post body (paraname1-paravalue1&paraname2=paravalue2...) inside DataPower?
        >
        I created a HTTP form and did submit against a Non-XML request type service with just a convert-http action.

        What I get for fields "a" and "b" filled with values "1" and "23" is this.
        
        <request><url>/</url><base-url>/</base-url><args src=
        'url'></args><args src=
        'body'><arg name=
        "a">1</arg><arg name=
        "b">23</arg></args></request>
        


        Just having RESULT action with input "INPUT" this gets returned (that is what the browser did send):
        
        -----------------------------28316839514392203651421186137 Content-Disposition: form-data; name=
        "a"   1 -----------------------------28316839514392203651421186137 Content-Disposition: form-data; name=
        "b"   23 -----------------------------28316839514392203651421186137--
        


        Not sure where you see a standard post body (paraname1-paravalue1&paraname2=paravalue2) in your scenario.
        My HTTP form has enctype="multipart/form-data" -- is your's different?
        This is the stylesheet way to "unarg", but probably RESULT action is what works better in your scenario:
        
        $ coproc2 unarg.xsl args.xml http:
        //dp3-l3:2223; echo a=1&amp;b=23 $ $ cat unarg.xsl <xsl:stylesheet version=
        "1.0" xmlns:xsl=
        "http://www.w3.org/1999/XSL/Transform" > <xsl:output method=
        "xml"/>   <xsl:template match=
        "/"> <xsl:for-each select=
        "/request/args[@src='body']/arg"> <xsl:value-of select=
        "concat(@name,'=',.)"/>   <xsl:
        
        if test=
        "position()!=last()"> <xsl:text>&amp;</xsl:text> </xsl:if> </xsl:for-each> </xsl:template>   </xsl:stylesheet> $
        


         
        Hermann<myXsltBlog/> <myXsltTweets/>
        • jaluecht
          jaluecht
          29 Posts
          ACCEPTED ANSWER

          Re: Processing http post/get requests

          ‏2013-02-20T16:41:13Z  in response to HermannSW
          Thanks for your reply. Sorry, I know I may be a little confusing.

          I was trying to get this to work trying multiple different approaches, including some documentation you had in your blog.

          What I have now working is what you have basically suggested. I do have one last question concerning this setup.

          Our base flow of request processing is to have a single MPG (Dispatcher) listening on port 443. This MPG is configured to process XML RequestTypes/ResponseType.

          To process this type of request, which is in the form of HTTP posts with standard post bodies (non xml/json) I have created a separate MPG (HttpMPG). This has a RequestType=NON-XML and a ResponseType=XML (All responses from this service are XML).

          I tried to us the existing handler (443 HTTPS) for HttpMPG.

          I have bound FSH HTTP handles to multiple WS Proxies within a single domain. It appears that you can only bind a FSH Handler to one MPG - is this correct?
          • HermannSW
            HermannSW
            4490 Posts
            ACCEPTED ANSWER

            Re: Processing http post/get requests

            ‏2013-02-20T22:34:17Z  in response to jaluecht
            >
            > I have bound FSH HTTP handles to multiple WS Proxies within a single domain. It appears that you can only bind a FSH Handler to one MPG - is this correct?
            >
            yes, WSP is the only service able to share FSHs.
            You cannot share FSH ports for any other service.

             
            Hermann<myXsltBlog/> <myXsltTweets/>
            • jaluecht
              jaluecht
              29 Posts
              ACCEPTED ANSWER

              Re: Processing http post/get requests

              ‏2013-02-21T18:57:17Z  in response to HermannSW
              Thanks for all of your assistance. I have the MPG processing away on the incoming posts. I have one final question (hopefully).

              I have the MPG set to process RequestType=NON-XML. The ResponseType=XML.

              Is there anyway to see the raw data in the request? Probe doesn't show the content - it does show accurate Content-Length.

              I have tried a log action to capture the input context to a log target, but the contents are empty (just like the probe).
              • HermannSW
                HermannSW
                4490 Posts
                ACCEPTED ANSWER

                Re: Processing http post/get requests

                ‏2013-02-21T19:34:50Z  in response to jaluecht
                Hi Jeff,

                > ...
                > I have the MPG set to process RequestType=NON-XML. The ResponseType=XML.
                >
                > Is there anyway to see the raw data in the request? Probe doesn't show the content - it does show accurate Content-Length.
                >
                > I have tried a log action to capture the input context to a log target, but the contents are empty (just like the probe).

                please select your rule in "Object->XML Processing->Processing Rule" and switch "Non-XML Processing" to "On".
                As you can see in below screenshot, the INPUT context appears in hexadecimal Probe display then ...


                 
                Hermann<myXsltBlog/> <myXsltTweets/>