Topic
  • 10 replies
  • Latest Post - ‏2014-07-26T17:16:57Z by HermannSW
ShubhP
ShubhP
7 Posts

Pinned topic Regarding parameters set in an HTTP POST request

‏2014-07-22T10:09:49Z |
Hi
 
We have a requirement where DataPower needs to the do the HTTP Post to Restful API.  From the Provider back-end (Rest API ),  only http URL format has been given,  which have some http parameters from the beginning of the url ( after that there is a url data which correspond to the message for which we need to Post)
 
I have two doubts :
 
- If DataPower going to do http post for outgoing message by using result action,  then there will be no issue when it will hit to the back-end host ,  data automatically reach to API as part of http URL.
 
- How I can set parameters in outgoing http URL which are not part of outgoing post message. I am using routing-url variable to set the back-end host.
 
Thanks in advance 
  • UlrikAndersen
    UlrikAndersen
    262 Posts

    Re: Regarding parameters set in an HTTP POST request

    ‏2014-07-22T11:26:07Z  

    You can write the whole thing to var://service/routing-url - protocol, host, URI and query string (URL encoded).

  • ShubhP
    ShubhP
    7 Posts

    Re: Regarding parameters set in an HTTP POST request

    ‏2014-07-24T23:38:49Z  

    You can write the whole thing to var://service/routing-url - protocol, host, URI and query string (URL encoded).

    Thanks Andersen, using like that now as shown below  ( after setting the required variables value in the style sheet)

    <dp:set-variablename="'var://service/routing-url'"value="concat('http//:',$LoadbalancerName,$requestParameters,$output)" />

     

    But datapower probe shows  value for 'var://service/routing-url'is  'file:///http//:TEST1_LBcgi-bin/velocity.exe?v.function=abc-xml&v.indent=true&collection

     

    'file:///' causing problem with invalid backend protocol. Please advice.

     

    Thanks for help.

  • HermannSW
    HermannSW
    6388 Posts

    Re: Regarding parameters set in an HTTP POST request

    ‏2014-07-25T08:00:19Z  
    • ShubhP
    • ‏2014-07-24T23:38:49Z

    Thanks Andersen, using like that now as shown below  ( after setting the required variables value in the style sheet)

    <dp:set-variablename="'var://service/routing-url'"value="concat('http//:',$LoadbalancerName,$requestParameters,$output)" />

     

    But datapower probe shows  value for 'var://service/routing-url'is  'file:///http//:TEST1_LBcgi-bin/velocity.exe?v.function=abc-xml&v.indent=true&collection

     

    'file:///' causing problem with invalid backend protocol. Please advice.

     

    Thanks for help.

    Hi,

    is your service a MPGW?
    Did you specify "dynamic-backends" as Type?
    Which firmware version?


    Hermann.

  • ShubhP
    ShubhP
    7 Posts

    Re: Regarding parameters set in an HTTP POST request

    ‏2014-07-25T08:31:58Z  
    • HermannSW
    • ‏2014-07-25T08:00:19Z

    Hi,

    is your service a MPGW?
    Did you specify "dynamic-backends" as Type?
    Which firmware version?


    Hermann.

    Hi Hermann

    Its a MPGW 

    Yes, its Type is  "dynamic-backends" .

    firmware is XI50..4.0.2.1

    Thanks

    Vishnu

  • kenhygh
    kenhygh
    2164 Posts

    Re: Regarding parameters set in an HTTP POST request

    ‏2014-07-25T12:02:14Z  
    • ShubhP
    • ‏2014-07-24T23:38:49Z

    Thanks Andersen, using like that now as shown below  ( after setting the required variables value in the style sheet)

    <dp:set-variablename="'var://service/routing-url'"value="concat('http//:',$LoadbalancerName,$requestParameters,$output)" />

     

    But datapower probe shows  value for 'var://service/routing-url'is  'file:///http//:TEST1_LBcgi-bin/velocity.exe?v.function=abc-xml&v.indent=true&collection

     

    'file:///' causing problem with invalid backend protocol. Please advice.

     

    Thanks for help.

    you've set var://service/routing-url to something malformed, and DP is trying to fix it for you.

    value="concat('http//:',$LoadbalancerName,$requestParameters,$output)"

    needs changed to

    value="concat('http://',$LoadbalancerName,$requestParameters,$output)"

  • ShubhP
    ShubhP
    7 Posts

    Re: Regarding parameters set in an HTTP POST request

    ‏2014-07-25T12:24:44Z  
    • kenhygh
    • ‏2014-07-25T12:02:14Z

    you've set var://service/routing-url to something malformed, and DP is trying to fix it for you.

    value="concat('http//:',$LoadbalancerName,$requestParameters,$output)"

    needs changed to

    value="concat('http://',$LoadbalancerName,$requestParameters,$output)"

    thanks ken !! 

  • ShubhP
    ShubhP
    7 Posts

    Re: Regarding parameters set in an HTTP POST request

    ‏2014-07-26T09:48:32Z  
    • kenhygh
    • ‏2014-07-25T12:02:14Z

    you've set var://service/routing-url to something malformed, and DP is trying to fix it for you.

    value="concat('http//:',$LoadbalancerName,$requestParameters,$output)"

    needs changed to

    value="concat('http://',$LoadbalancerName,$requestParameters,$output)"

    Hi all

    still i am facing similar problem..now i need to send a encoded url, as given below :

    <xsl:variable name="FinalURL">
                <xsl:value-of select="dp:encode($FullURL,'URL')"/>
            </xsl:variable>
        <dp:set-variable name="'var://context/URL/routing-url'" value="$FinalURL"/>
            
            <dp:set-variable name="'var://service/routing-url'" value="$FinalURL"/>
     

    now due to encode function datapower again prefix 'file:///'  in the outbound url which again causing same issue (invalid url). Please suggest.

    Thanks  for the help.

  • HermannSW
    HermannSW
    6388 Posts

    Re: Regarding parameters set in an HTTP POST request

    ‏2014-07-26T13:59:28Z  
    • ShubhP
    • ‏2014-07-26T09:48:32Z

    Hi all

    still i am facing similar problem..now i need to send a encoded url, as given below :

    <xsl:variable name="FinalURL">
                <xsl:value-of select="dp:encode($FullURL,'URL')"/>
            </xsl:variable>
        <dp:set-variable name="'var://context/URL/routing-url'" value="$FinalURL"/>
            
            <dp:set-variable name="'var://service/routing-url'" value="$FinalURL"/>
     

    now due to encode function datapower again prefix 'file:///'  in the outbound url which again causing same issue (invalid url). Please suggest.

    Thanks  for the help.

    Please let us know how your <dp:url-open> looks now, and what the values of $FinalURL and $FullURL are.


    Hermann.

    Updated on 2014-07-26T13:59:41Z at 2014-07-26T13:59:41Z by HermannSW
  • ShubhP
    ShubhP
    7 Posts

    Re: Regarding parameters set in an HTTP POST request

    ‏2014-07-26T14:25:58Z  
    • HermannSW
    • ‏2014-07-26T13:59:28Z

    Please let us know how your <dp:url-open> looks now, and what the values of $FinalURL and $FullURL are.


    Hermann.

    Hi Hermann,

    Thanks for the reply. i am not using dp:url-open.

    below are the variables values :

    $FinalURL

    http%3A%2F%2FTEST1_LB%2Fcgi-bin%2Fvelocity.exe%3Fv.function%3.........

    $FullURL

    http://TEST1_LB/cgi-bin/velocity.exe?v.function=.......

    Updated on 2014-07-26T14:29:59Z at 2014-07-26T14:29:59Z by ShubhP
  • HermannSW
    HermannSW
    6388 Posts

    Re: Regarding parameters set in an HTTP POST request

    ‏2014-07-26T17:16:57Z  
    • ShubhP
    • ‏2014-07-26T14:25:58Z

    Hi Hermann,

    Thanks for the reply. i am not using dp:url-open.

    below are the variables values :

    $FinalURL

    http%3A%2F%2FTEST1_LB%2Fcgi-bin%2Fvelocity.exe%3Fv.function%3.........

    $FullURL

    http://TEST1_LB/cgi-bin/velocity.exe?v.function=.......

    Please only URL-encode the "values" in name-value pairs of query.
    http://TEST1_LB/cgi-bin/velocity.exe?v.function%3.........

    Without "http://..." the URL is not valid.
    URL-encoding is only allowed/needed
    "... When a character from the reserved set (a "reserved character") has special meaning (a "reserved purpose") in a certain context, and a URI scheme says that it is necessary to use that character for some other purpose, then the character must be percent-encoded. ..."


    So you need to do the reverse of utf8uri.xsl in this technote:
    http://www-01.ibm.com/support/docview.wss?uid=swg21412370
     

    Hermann.

    Updated on 2014-07-26T17:28:14Z at 2014-07-26T17:28:14Z by HermannSW