Topic
  • 16 replies
  • Latest Post - ‏2014-12-01T19:43:38Z by souciance
Stolbovsky
Stolbovsky
24 Posts

Pinned topic Using GET in Http Method Types

‏2012-02-16T14:26:53Z |
Hi!
I need to make get http request to a backside server after receiving message from MQ. I tried to use GET method in Results Action to do this, but datapower sends post request anyway.
Is there a way to make get request in such a case?

Regards,
Dmitry
Updated on 2012-10-09T06:00:21Z at 2012-10-09T06:00:21Z by Stolbovsky
  • Liv2luv
    Liv2luv
    573 Posts

    Re: Using GET in Http Method Types

    ‏2012-02-16T15:01:37Z  
    try with setting 'var://service/protocol-method' variable to GET or using the method rewrite action (from advanced) before making a call to the backend.
  • Stolbovsky
    Stolbovsky
    24 Posts

    Re: Using GET in Http Method Types

    ‏2012-02-17T07:36:09Z  
    • Liv2luv
    • ‏2012-02-16T15:01:37Z
    try with setting 'var://service/protocol-method' variable to GET or using the method rewrite action (from advanced) before making a call to the backend.
    I tried to use <dp:set-variable name="'var://service/protocol-method'" value="'GET'"/> It doesn't rewrite protocol-method service variable. The only thing I see in probe is changed string on top of the window MethodRewriteType=GET, MethodType=GET, MethodType2=POST. Before setting variable MethodType=POST.
    When I using Method Rewrite Action I doesn't see any differences at all.
    Do you know what MethodType2=POST means?
  • HermannSW
    HermannSW
    6388 Posts

    Re: Using GET in Http Method Types

    ‏2012-02-17T08:59:30Z  
    I tried to use <dp:set-variable name="'var://service/protocol-method'" value="'GET'"/> It doesn't rewrite protocol-method service variable. The only thing I see in probe is changed string on top of the window MethodRewriteType=GET, MethodType=GET, MethodType2=POST. Before setting variable MethodType=POST.
    When I using Method Rewrite Action I doesn't see any differences at all.
    Do you know what MethodType2=POST means?
    It is important to "setvar" the protocol-method and having NULL as input context of results action.
    See Wireshark "Follow TCP" output of captured backend interface traffic.

    The backend traffic is independent from frontside traffic, so I just did HTTP:
    
    $ curl --data-binary @some.xml http:
    //dp3-l3:2074/ab.xml <a>1<b>2</b>3</a> $
    


    This works:

    match(url=*)
    INPUT--setvar('var://service/protocol-method','GET')
    NULL--results(Method=POST)
    
    GET /ab.xml HTTP/1.1 User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.12.9.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2 Host: dp4-l3.boeblingen.de.ibm.com:80 Accept: *
    /* Content-Type: application/x-www-form-urlencoded origHost: dp3-l3:2074 Via: 1.1 post2get Connection: Keep-Alive X-Client-IP: 9.164.170.51 Content-Length: 0 HTTP/1.1 200 OK Date: Fri, 17 Feb 2012 08:53:10 GMT Server: Apache/2.2.3 (Red Hat) Last-Modified: Thu, 07 Jul 2011 08:52:45 GMT ETag: "f29692-12-d72ef140" Accept-Ranges: bytes Content-Length: 18 Keep-Alive: timeout=15 Connection: Keep-Alive Content-Type: text/xml <a>1<b>2</b>3</a>
    

    This is interesting, a GET request with body content.
    This seems not to be forbidden, search the web for "HTTP GET body" if you are interested.

    match(url=*)
    INPUT--setvar('var://service/protocol-method','GET')
    INPUT--results(Method=GET)
    
    GET /ab.xml HTTP/1.1 User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.12.9.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2 Host: dp4-l3.boeblingen.de.ibm.com:80 Accept: *
    /* Content-Type: application/x-www-form-urlencoded origHost: dp3-l3:2074 Via: 1.1 post2get Connection: Keep-Alive X-Client-IP: 9.164.170.51 Content-Length: 46 <?xml version="1.0" encoding="UTF-8"?> <some/>HTTP/1.1 200 OK Date: Fri, 17 Feb 2012 08:49:38 GMT Server: Apache/2.2.3 (Red Hat) Last-Modified: Thu, 07 Jul 2011 08:52:45 GMT ETag: "f29692-12-d72ef140" Accept-Ranges: bytes Content-Length: 18 Keep-Alive: timeout=15 Connection: Keep-Alive Content-Type: text/xml <a>1<b>2</b>3</a>
    


     
    Hermann<myXsltBlog/>
  • Stolbovsky
    Stolbovsky
    24 Posts

    Re: Using GET in Http Method Types

    ‏2012-10-09T06:00:21Z  
    I tried to use 3 different methods but they dont work.
    1. Using <dp:set-variable name="'var://service/protocol-method'" value="'GET'"/> in Processing Action.
    2. Using Set Variable Action with variable name var://service/protocol-method and variable assignment=GET.
    3. Using Method Rewrite Action with Method=GET.
    The Processing rule in all cases looks like this:
    match
    processing action to transform input from MQ Queue (Input=NULL,Output=NULL)
    set variable action (Context=NULL) or method rewrite method (Method=GET)
    results action (Input=NULL, Output=NULL, Method=GET)
    In all cases DataPower makes POST request to backend server.
    In debug probe variable var://service/protocol-method value was 'POST'
    It seems like a bug.
    What I'm doing wrong?

    Regards,
    Dmitry
  • amae
    amae
    5 Posts

    Re: Using GET in Http Method Types

    ‏2014-11-20T11:51:16Z  
    I tried to use 3 different methods but they dont work.
    1. Using <dp:set-variable name="'var://service/protocol-method'" value="'GET'"/> in Processing Action.
    2. Using Set Variable Action with variable name var://service/protocol-method and variable assignment=GET.
    3. Using Method Rewrite Action with Method=GET.
    The Processing rule in all cases looks like this:
    match
    processing action to transform input from MQ Queue (Input=NULL,Output=NULL)
    set variable action (Context=NULL) or method rewrite method (Method=GET)
    results action (Input=NULL, Output=NULL, Method=GET)
    In all cases DataPower makes POST request to backend server.
    In debug probe variable var://service/protocol-method value was 'POST'
    It seems like a bug.
    What I'm doing wrong?

    Regards,
    Dmitry

    We are having the exact same issue. Is there any solution for this?

     

    Amanda

  • kenhygh
    kenhygh
    2164 Posts

    Re: Using GET in Http Method Types

    ‏2014-11-20T14:16:05Z  
    • amae
    • ‏2014-11-20T11:51:16Z

    We are having the exact same issue. Is there any solution for this?

     

    Amanda

    What have you tried?

  • amae
    amae
    5 Posts

    Re: Using GET in Http Method Types

    ‏2014-11-20T14:31:15Z  
    • kenhygh
    • ‏2014-11-20T14:16:05Z

    What have you tried?

    Everything as explained by Stolbovsky in the previous posts.

     

    I am getting a XML message of a MQ Q that will contain a URL where I have to go get a jpg from. The jpg must then go on the response Q to be saved as a file to a target directory bu the app reading the response Q. 

    I must warn you I am very inexperienced with datapower and the problem might be between the keyboard an the chair. 

    When I do the above HTTP -> HTTPS all works and I see the image in the requesting browser. Then I change my MPGW to MQ FSH -> HTTPs and what I get on the reponse Q is HTML stating that 'POST' is not a valid method for this site. 

    I tried changing var://service/protocol-method to 'GET' in various ways but at the end what is passed to the backend is 'POST' 

  • kenhygh
    kenhygh
    2164 Posts

    Re: Using GET in Http Method Types

    ‏2014-11-20T15:47:45Z  
    • amae
    • ‏2014-11-20T14:31:15Z

    Everything as explained by Stolbovsky in the previous posts.

     

    I am getting a XML message of a MQ Q that will contain a URL where I have to go get a jpg from. The jpg must then go on the response Q to be saved as a file to a target directory bu the app reading the response Q. 

    I must warn you I am very inexperienced with datapower and the problem might be between the keyboard an the chair. 

    When I do the above HTTP -> HTTPS all works and I see the image in the requesting browser. Then I change my MPGW to MQ FSH -> HTTPs and what I get on the reponse Q is HTML stating that 'POST' is not a valid method for this site. 

    I tried changing var://service/protocol-method to 'GET' in various ways but at the end what is passed to the backend is 'POST' 

    is the input context of your Results action NULL?

    [unfortunately, I do not have access to MQ so I can't test this]

  • amae
    amae
    5 Posts

    Re: Using GET in Http Method Types

    ‏2014-11-21T08:24:35Z  
    • kenhygh
    • ‏2014-11-20T15:47:45Z

    is the input context of your Results action NULL?

    [unfortunately, I do not have access to MQ so I can't test this]

    We have tried action NULL for Result and various other combinations. 

  • NILAY97
    NILAY97
    313 Posts

    Re: Using GET in Http Method Types

    ‏2014-11-21T09:34:22Z  
    • amae
    • ‏2014-11-21T08:24:35Z

    We have tried action NULL for Result and various other combinations. 

    Hello Amae,

    What input do you get from client? I can see everything to be NULL in the processing you doing on DataPower.

    Ideally, a method-rewrite shoud work here. Is your transaction independent of the client payload?

    Can you try setting the following:-

    INPUT for Method Rewrite

    INPUT for Results

    with Output pointing to OUTPUT.

    Thanks,

    Nilay

  • kenhygh
    kenhygh
    2164 Posts

    Re: Using GET in Http Method Types

    ‏2014-11-25T14:44:26Z  
    • amae
    • ‏2014-11-21T08:24:35Z

    We have tried action NULL for Result and various other combinations. 

    Well, I finally built out a testcase and it fails. I created RFE 62441.

  • amae
    amae
    5 Posts

    Re: Using GET in Http Method Types

    ‏2014-11-25T14:51:10Z  
    • kenhygh
    • ‏2014-11-25T14:44:26Z

    Well, I finally built out a testcase and it fails. I created RFE 62441.

    Thank you.

    What is a RFE?

  • kenhygh
    kenhygh
    2164 Posts

    Re: Using GET in Http Method Types

    ‏2014-11-25T14:54:03Z  
    • amae
    • ‏2014-11-25T14:51:10Z

    Thank you.

    What is a RFE?

    Request For Enhancement.

    You can see it, and vote for it, at https://www.ibm.com/developerworks/rfe/execute?use_case=searchRFEs&SELECTED_SEARCH_TAB=TAB2&HIDE_DESCRIPTIONS=true&SORT_BY=CREATE_DATE&SORT_ORDER=DESC&is_javascript_enabled=true&rfenumber=id&ibm-search=Search&CR_ID=62441

  • souciance
    souciance
    203 Posts

    Re: Using GET in Http Method Types

    ‏2014-12-01T08:59:56Z  
    • kenhygh
    • ‏2014-11-25T14:54:03Z

    For me this is a major bug. Even with set var to change the protcol method it remains as POST. Surely there should be an easy way to allow DP to do a GET or POST.

    Now it seems the only way is to do url-opens and then I am wondering why use the configurations in the first place.

  • kenhygh
    kenhygh
    2164 Posts

    Re: Using GET in Http Method Types

    ‏2014-12-01T11:09:44Z  
    • souciance
    • ‏2014-12-01T08:59:56Z

    For me this is a major bug. Even with set var to change the protcol method it remains as POST. Surely there should be an easy way to allow DP to do a GET or POST.

    Now it seems the only way is to do url-opens and then I am wondering why use the configurations in the first place.

    Would you please send me an email? khygh@us.ibm.com

  • souciance
    souciance
    203 Posts

    Re: Using GET in Http Method Types

    ‏2014-12-01T19:43:38Z  

    I got this to work. However I had to resort to do url-open to do a HTTP GET based on MQ FSH.