Bug with rbv_api.sendHttpPost(url, params, headers) - Forum - Rollbase - Progress Community

Bug with rbv_api.sendHttpPost(url, params, headers)

 Forum

Bug with rbv_api.sendHttpPost(url, params, headers)

  • Hello,

    As you have already discovered, the sendHttpPost  

    api sends it as multi part  request, and uses chunked encoding.

    I have tested your trigger code with headers and without headers on a developer build.  

    I also put in a customer header in the request.

    And with the same php ( running on wamp 2.2).  It does show the correct POST data on all tests.

    So a couple of questions for you,

    1. What version of RB are you having trouble with?

    2. What is the environment on which you host php? ( Not that this is where the likely problem is.. but just eliminating any suspicion if I can)

  • > 1. What version of RB are you having trouble with?

    1.0.0.0 and 2.0.0.3

    > 2. What is the environment on which you host php?

    Apache/2.2.3 (CentOS), PHP version 5.3.3

    When php receives the posted data there is only $HTTP_RAW_POST_DATA array populated, $_POST array is empty.

    sample of $HTTP_RAW_POST_DATA array:

    --3fvU0jhZR-TIk2pNNMcEabbbFwd2iAw5q

    Content-Disposition: form-data; name="grant_type"

    Content-Type: text/plain; charset=UTF-8

    Content-Transfer-Encoding: 8bit

    client_credentials

    --3fvU0jhZR-TIk2pNNMcEabbbFwd2iAw5q--

    PHP code:

    <?php

    print_r($_SERVER);

    print_r($HTTP_RAW_POST_DATA);

    print_r($_POST);

    ?>

  • Arrrrggghhh! This comments box still doesn't accept Code

  • > 1. What version of RB are you having trouble with?

    1.0.0.0 and 2.0.0.3

    > 2. What is the environment on which you host php?

    Apache/2.2.3 (CentOS), PHP version 5.3.3

    When php receives the posted data there is only $HTTP_RAW_POST_DATA array populated, $_POST array is empty.

    sample of $HTTP_RAW_POST_DATA array:

    /*

    --3fvU0jhZR-TIk2pNNMcEabbbFwd2iAw5q

    Content-Disposition: form-data; name="grant_type"

    Content-Type: text/plain; charset=UTF-8

    Content-Transfer-Encoding: 8bit

    client_credentials

    --3fvU0jhZR-TIk2pNNMcEabbbFwd2iAw5q--

    PHP code:

    <?php

    print_r($_SERVER);

    print_r($HTTP_RAW_POST_DATA);

    print_r($_POST);

    ?>

    */

  • Hello, As you have already discovered, the sendHttpPost api sends it as multi part request, and uses chunked encoding. I have tested your trigger code with headers and without headers on a developer build. I also put in a customer header in the request. And with the same php ( running on wamp 2.2). It does show the correct POST data on all tests.

    So a couple of questions for you,

    1. What version of RB are you having trouble with?

    2. What is the environment on which you host php?

  • OK. Let me test on 2.0.0.3 and get back to you.

  • Thanks for helping. I already answered these questions above...

  • Same issue on 2.0.0.4

  • Hi, I'm trying to check if your php supports  multipart/form-data.

    Can you have an html which contains the below form & submit it and see if you get  the form values  $_POST ? 

    <form action="your_target.php"
    method="post" enctype="multipart/form-data">
    First name: <input type="text" name="fname"><br>
    Last name: <input type="text" name="lname"><br>
    <input type="submit" value="Submit">

    </form>

    Your previous post (raw post data) shows that the data is reaching the server. 

    --3fvU0jhZR-TIk2pNNMcEabbbFwd2iAw5q

    Content-Disposition: form-data; name="grant_type"

    Content-Type: text/plain; charset=UTF-8

    Content-Transfer-Encoding: 8bit

    client_credentials

    --3fvU0jhZR-TIk2pNNMcEabbbFwd2iAw5q--

    Another thought ( need to verify ) : This may be our issue https://bugs.php.net/bug.php?id=50210

  • Here is our php script test.php:

    <?php

    if ($_SERVER["REQUEST_METHOD"] == "POST") {

           print "<h1>Server</h1>\n<pre>";

           print_r($_SERVER);

           print "</pre><h1>REQUEST</h1>\n<pre>";

           print_r($_REQUEST);

           print "</pre><h1>RAW POST DATA</h1>\n<pre>";

           if (isset($HTTP_RAW_POST_DATA) && !empty($HTTP_RAW_POST_DATA))

                   print_r($HTTP_RAW_POST_DATA);

           else

                   print "empty...\n\n";

           print "</pre><h1>POST</h1>\n<pre>";

           print_r($_POST);

           print "</pre>";

    }

    ?>

    <form action="our_script.php"

    method="post" enctype="multipart/form-data">

    First name: <input type="text" name="fname"><br>

    Last name: <input type="text" name="lname"><br>

    <input type="submit" value="Submit">

    </form>

    Output:

    Server

    Array
    (
        [SCRIPT_URL] => /test.php
        [SCRIPT_URI] => http://oursite.com/test.php
        [HTTP_HOST] => oursite.com
        [HTTP_USER_AGENT] => Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20131101 Firefox/24.0 Iceweasel/24.1.0
        [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
        [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.5
        [HTTP_ACCEPT_ENCODING] => gzip, deflate
        [HTTP_REFERER] => http://oursite.com/test.php
        [CONTENT_TYPE] => multipart/form-data; boundary=---------------------------3621816720535931238390484
        [CONTENT_LENGTH] => 282
        [HTTP_CACHE_CONTROL] => max-age=259200
        [HTTP_CONNECTION] => keep-alive
        [PATH] => /usr/local/bin:/usr/bin:/bin
        [SERVER_SIGNATURE] =>
    Apache/2.2.9 (Debian) mod_gnutls/0.5.1 PHP/5.2.6-1+lenny16 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g mod_wsgi/2.5 Python/2.5.2 Server at oursite.com Port 80
        [SERVER_SOFTWARE] => Apache/2.2.9 (Debian) mod_gnutls/0.5.1 PHP/5.2.6-1+lenny16 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g mod_wsgi/2.5 Python/2.5.2
        [SERVER_NAME] => oursite.com
        [SERVER_ADDR] => 192.168.20.108
        [SERVER_PORT] => 80
        [REMOTE_ADDR] => 192.168.20.108
        [DOCUMENT_ROOT] => /home/vhosts/oursite/httpdocs
        [SERVER_ADMIN] => [no address given]
        [SCRIPT_FILENAME] => /home/vhosts/oursite/httpdocs/test.php
        [REMOTE_PORT] => 39385
        [GATEWAY_INTERFACE] => CGI/1.1
        [SERVER_PROTOCOL] => HTTP/1.1
        [REQUEST_METHOD] => POST
        [QUERY_STRING] => 
        [REQUEST_URI] => /test.php
        [SCRIPT_NAME] => /test.php
        [PHP_SELF] => /test.php
        [REQUEST_TIME] => 1386229137
        [argv] => Array
            (
            )
    
        [argc] => 0
    )
    

    REQUEST

    Array
    (
        [fname] => Tester
        [lname] => Tester
    )
    

    RAW POST DATA

    empty...
    
    

    POST

    Array
    (
        [fname] => Tester
        [lname] => Tester
    )
    


    As for your thought about the php bug, it may be related to but the php script is just a way to debug requests sent by RollBase as actually we need to implement PayPal REST API and PayPal doesn't also accept POST from RollBase.

    For example,  we implement Authentication request (see below) in RollBase and we get  "415 Unsupported Media Type" error. 

    So we think it's not only PHP issue with a data submitted by RollBase.

    curl -v https://api.sandbox.paypal.com/v1/oauth2/token -H "Accept: application/json"  -H "Accept-Language: en_US"   -u "EOJ2S-Z6OoN_le_KS1d75wsZ6y0SFdVsY9183IvxFyZp:EClusMEUk8e9ihI7ZdVLF5cZ6y0SFdVsY9183IvxFyZp"  -d "grant_type=client_credentials"

    See https://developer.paypal.com/webapps/developer/docs/api/ for a reference.

  • This is an issue and has been logged as a defect. We will be fixing it in the future releases.

  • We are a business that has invested in the Rollbase system to use for daily operations.

    "We will be fixing it in the future releases" is not an acceptable answer.

    I would like a timescale please? And for updates if that timescale cannot be met.

    This is a bug, with a well-articulated and reproduceable description, for a feature that is not working as advertised, that has taken amonth just to get acknowledged - I would like a date when this will be fixed.

    This Private Cloud is currently not very impressed with the Progress.com development speed, and understanding of Rollbase development needs - I would like to see more urgent effort to remedy this.

    Currently it appears that Rollbase development is almost stagnant - which is not encouraging for investing in a stystem that people will rely upon for daily operations.