Post request

Hello guys, so far my experience to build a BB app was interesting now am stuck with a problem that should be very simple, but I don't know what wrong am doin. trying to send data of connection to the server by using the POST method. have searched online and I tried all useful information, I am, but still the same problem. the connection and everything works greate, but data is not sent. When I check my apache error log, I see that the post parameter is not defined. DOWNLOAD the method works perfectly but not post. could it be because am working on a Simulator or it is or the deviceside = true parameter have nothing to do with it. would appreciate some help here. Here's that part of the code uses.

private void postURL() {}
String postString = postDataField.getText ();
URLEncodedPostData encodedData = new URLEncodedPostData (null, false);
encodedData.append ("content", postString);
HttpRequestDispatcher dispatcher = new HttpRequestDispatcher (urlField
(. getText(), 'POST', this, encodedData.getBytes ());
Dispatcher.Start ();
}

public HttpRequestDispatcher (String url, String, screen NetworkingMainScreen method, postData byte []) {}
This.url = url;
This.Method = method;
This.screen = screen;
this.postData = postData;
}

public void run() {}
try {}
HttpConnection connection = (HttpConnection) Connector.open (url);
connection.setRequestMethod (method);
If (method.equals ("POST") & postData! = null) {}
connection.setRequestProperty ("Content-type", "application/www-formulaires-urlencoded");
OutputStream requestOutput = connection.openOutputStream ();
requestOutput.write (postData);
requestOutput.close ();
}
int responseCode = connection.getResponseCode ();
If (responseCode! = HttpConnection.HTTP_OK) {}
screen.requestFailed ("unexpected response code:" + responseCode);
Connection.Close;
return;
}

Thanks for your reply. He showed me something that I had not seen in my code before. so I changed to "application/x-www-formulaires-urlencoded" and included the header as well and everything works fine I was missing a dash in "application/www-formulaires-urlencoded". Thank you

Tags: BlackBerry Developers

Similar Questions

  • Help with JSON HTTP Post request

    Still fairly new to QT so I try to send a query with some json http post, I'm pulling the json to a file and which seems to work fine but I get a http 500 error. I want to just make sure that my code is correct before contacting the company that webservice I use here is my code:

     JsonDataAccess jda;
        QVariant list = jda.load(QDir::currentPath() +"/app/native/assets/jsonData/myjson.json");
    
        qDebug()<post(request, list.toByteArray());
    

    I have a feeling that I'm passing in json data in the wrong post method. Any help is appreicated

    Hello

    You send an empty server string because list.toByteArray () returns an empty string.

    You must save the QByteArray list;

    QByteArray result;
    jda.saveToBuffer(list, &result);
    
    // and then
    
    QNetworkReply *reply = networkAccessManager->post(request, result);
    

    or

    Simply load the json with QFile file

    QFile file(YOUR_JSON);
    if (!file.open(QIODevice::ReadOnly)){
        qDebug() << Q_FUNC_INFO << file.errorString();
        return;
    }
    QByteArray result = file.readAll();
    file.close()
    
    QNetworkReply *reply = networkAccessManager->post(request, result);
    

    Hoe it helps

  • POST requests have failed by deployed/used app, gets is OK but

    Recently, my implementation faces a problem with sending of POST requests, when I run the browser all my queries work very well. When I try to do a POST through the emulator of the ripple, phonegap app on the device, or a built apk, they will fail and I get no information about the exception. I know that my endpoint is fine because A. It works in the browser and B. I can raise requests in fiddler all day without problem. This leads me to believe it's a matter of phonegap, what I had before where I had to update the CLI version and miraculously, he started to work again... This time I've updated 6.1.0 6.3.0 and no luck...

    The application uses Angular1 and sends the MESSAGE via $http.

    I have the plugin list white and everything set as allow in the config.xml file

    < name of the ditch: plugin = "cordova-plugin-whitelist" source = "MNP" / >

    < allow navigation href = "" * "/ >"

    < access origin = "" * "/ >"

    < allow intention href = "" * "/ >"

    Here's what I got when I tried to log the exception, first line is a handmade journal when the error was caught, second line is the error that was taken... aka nothing.

    [phonegap] [console.log] Exception occurred while inserting the mobile user record

    [phonegap] [console.log] {}

    Any help is appreciated.

    Issue in the browser seems intent... That is 100% my fault, I didn't have a script in source for angular-local-storage. However, the 503 error is always produced by ripple and it seems that my Android becomes a completely different error.

    Ripple using 503 error displays in the console that phonegap is served.

    Using my Android device - no newspaper is connected to the console - but the alert began my error $http function

    ------------------------------

    a little later since I have actually never posted ^ ^ ^

    If the first cause of all it was a problem with MY code. No PhoneGap. However, ripple still exposes the strange 503 even when I have both the browser and the Android operation. I have no idea why its happening and that sucks because the ripple is really a nice place to debug to except if I something is misconfigured, who, like this post, can attest, is entirely possible.

  • Send the POST request with BLOB content

    Hello

    I usually use the following structure to send the POST request with content of varchar2 and numbers

          content := '{"Original File Name":"'||V_HOMEBANNER_1_EN_NAME(indx)||'"}';
         url := 'https://api.appery.io/rest/1/db/Names'; 
          req     := utl_http.begin_request(url, 'POST',' HTTP/1.1');
          UTL_HTTP.set_header(req, 'X-Appery-Database-Id', '5f2dac54b02cc6402dbe');
          utl_http.set_header(req, 'content-type', 'application/json');
          UTL_HTTP.set_header(req, 'X-Appery-Session-Token', sessionToken);
          utl_http.set_header(req, 'Content-Length', LENGTH(content));
          utl_http.write_text(req, content);
          res := utl_http.get_response(req);
    
    
    BEGIN
      LOOP
        utl_http.read_line(res, buffer);
      END LOOP;
      utl_http.end_response(res);
    EXCEPTION
    WHEN utl_http.end_of_body THEN
      utl_http.end_response(res);
    END;
    

    And it works very well. However, now I want to send/download (jpg image) files a blob in a MongoDB collection called "Files" (so url: = ttps://api.appery.io/rest/1/db/files). The guide of the collection is the next loop as a general advice:

    curl -X POST \
      -H "X-Appery-Database-Id: 5f2dac54b02cc6402dbe" \
      -H "X-Appery-Session-Token: <session_token>" \
      -H "Content-Type: <content_type>" \
      --data-binary '<file_content>' \
      https://api.appery.io/rest/1/db/files/<file_name>
    

    But I couldn't translate this curvature in PL/SQL query. Specifically, the part (-given binary '< file_content >")

    I have these BLOB files in an Oracle table, and they are stored with their names as follows:

    File_name File_content
    PIC_1.jpgBLOB OBJECT
    PIC_2.jpgBLOB OBJECT
    PIC_3.jpgBLOB OBJECT

    My question, how to download these images in the target URL?

    After a few hours I spent on it, I got it working. My solutions is inspired by this http://blog.optiosys.com/?p=246

    Since you must send you no the (same) CLOB and BLOB files, you need just need to replace .write_text by .write_raw.

    Here is my part of work for your reference:

    content: = V_HOMEBANNER_1_EN (indx);    -blob

    file_name: = 'test.jpg ';

    URL: = "https://api.appery.io/rest/1/db/files/": file_name;

    Req: = utl_http.begin_request (url, 'POST', ' HTTP/1.1');

    Utl_http.set_header (req, 'X-Appery-database - Id', '53fae4b02cc4021dbe');

    Utl_http.set_header (req, 'X-Appery-Session-token', sessionToken);

    Utl_http.set_header (req, "content-type', ' image/jpeg");

    req_length: = DBMS_LOB.getlength (CONTENT);

    DBMS_OUTPUT. Put_line (req_length);

    -IF YOU LIMIT THE DATA UNDER 32KB MSG:

    IF req_length<=>

    THEN

    Start

    Utl_http.set_header (req, "Content-Length", req_length);

    Utl_http.write_raw (req, content);

    exception

    while others then

    DBMS_OUTPUT. Put_line (SQLERRM);

    end;

    -IF MSG DATA MORE THAN 32 KB

    ELSIF req_length > 32767

    THEN

    BEGIN

    DBMS_OUTPUT. Put_line (req_length);

    Utl_http.set_header (req, "Transfer-Encoding", "Chunked");

    While (offset<>

    LOOP

    DBMS_LOB. Read (content, amount, offset, buffer);

    Utl_http.write_raw (req, buffer);

    offset: = offset + amount;

    END LOOP;

    exception

    while others then

    DBMS_OUTPUT. Put_line (SQLERRM);

    end;

    END IF;

    l_http_response: = UTL_HTTP.get_response (req);

    Utl_http.READ_TEXT (l_http_response, response_body, 32767);

    Utl_http.end_response (l_http_response);

    I hope this helps. Good luck

  • vCenter Orchestrator HTTP API: POST request error 400 1032

    I'm trying to start a workflow via a POST request to the vCenter Orchestrator API. When I run the same workflow with a GET request, there is no problem and I get the following result in the localhost_access_log.current_date.txt:

    [src_ip_address] - [13/Oct / 2015:04:46:00 + 0000] "GET vco/api/flux/af83cf34-6a00-45b5-946e-0d44ece508bb/exécutions/HTTP/1.1" 200 272

    However, when I run a POST with the following parameters:

    restMethod: POST

    restEndpoint: https://[dest_ip_address]:8281

    restPath: / vco/api/workflows/af83cf34 - a 6, 00-45 b 5 - 946e - 0d44ece508bb/executions /

    user: [username]

    content: {"parameters": [{'name': 'name1', 'type': 'string', 'value': {'chain': {"value": "Value1"}}, 'field': 'local'}]}

    contentType: application/json

    accept: application/json

    I have the following error in localhost_access_log.current_date.txt:

    [src_ip_address] - [13/Oct / 2015:03:53:39 + 0000] "POST vco/api/flux/af83cf34-6a00-45b5-946e-0d44ece508bb/exécutions/HTTP/1.1" 400 1032

    And the output on the client side:

    {Success = no, ResponseHeader = {null = HTTP/1.1 400 Bad Request, Server = Apache-Coyote/1.1 Content-Length = 1032, Content-Language = EN, connection = closed, Date-Wed, 13 Oct 2015 Message = Bad Request, ReasonPhrase is Bad Request, StatusCode = 400}}

    I'm in vCenter Orchestrator 5.5. There is no output to the server.log file. I didn't have a chance, researching the 400 1032' error number. [dest_ip_address] is HTTPS. Can anyone help clarify this?

    The command line below seems to work for me using the cmd terminal Windows:

    curl u - ikv name h ' Accept: application/json ' h ' Content-Type: application/json "d" {\"parameters\":[{\"value\":{\"string\":{\"value\":\"value1\"}},\"type\":\"string\",\"name\":\"name1\",\"scope\":\"local\" "}]}" x POST https://ip_address:8281/vco/api / stream/af83cf34-6a00-45b5-946e-0d44ece508bb/executions

    Note that the double quotes inside the body of the request are preceded by the backslash character.

  • Where can we post requests for features for TVs?

    Anyone know where can post us requests for features for TVs?

    For example, it would be nice to access usb connected to the TV via network.

    You can post it here hoping that someone from Toshiba read this.

  • How to add a JSON object in the body of a HTTP POST request

    Hello

    I use Java 8 ME incorporated and I would add a Json object in the body of an http request.

    I would like to do something like:

    -----------------------------------------------------------------------------------------

    HttpClientBuilder clientBuilder = HttpClientBuilder.getInstance ();

    HttpClient client = clientBuilder.build ();

    HttpRequestBuilder requestBuilder = client.build ("my_URI");
    requestBuilder.setHeader (HttpHeader.ACCEPT, "text/plain");

    [...]

    requestBuilder.setMethod (HttpMethod.POST);


    HttpRequest request = requestBuilder.build ();

    creating the Json object to be sent in the body of the http request
    JsonObject myJsonObj = Json.createObjectBuilder)
    . Add ("firstname", "John")
    . Add ("lastname", "XXX")
    . Build();

    This part, I'm a little confused: how to get the OutputStream where I should put the Json object?

    JsonWriter jsonWriter = Json.createWriter (java.io.OutputStream of);

    jsonWriter.writeObject (myJsonObj);

    jsonWriter.close ();

    invoking the http request

    HttpResponse response = request.invoke ();

    -----------------------------------------------------------------------------------------

    Have a tip, please?
    Thanks in advance.

    Bruno

    We need to create the class for this interface

  • "post requesties of installing oracle database 11g on windows".

    can any tell me what are the post installation requesties of installing oracle 11g on windows database?

    Thanks and greetings
    Vikash
    "All Izz well".

    See the documentation
    http://download.Oracle.com/docs/CD/E11882_01/install.112/e10843/postcfg.htm#i1006313

    See you soon
    Concerning
    Renjith Malet

  • What is the equivalent of a post request reports

    Hello

    I need to produce a report that is as my form. The form has a trigger after query that interrogate the description fields.

    I've almost finished my report but I need to find a way to make the post in connection request. I know that I can use
    formula field and that will work, but the way in which the post-requete fill in the description fields is by calling a procedure with 6 parameters out. I want to reuse the procedure. If there is no other choice, I have to call 6 times the procedure with the formula field.

    If something is not clear, let me know.

    Thank you

    Create columns of placement 6 CP at the same level the column in the column of formulas and formulas to fill columns of investment by calling the procedure. Put them in the layout. If this does not work, create columns of placement at the level of the report.

    Dave

  • Dynamic parameters for a CFHTTP POST request

    I need to call a service CFHTTP (Post), but the parameters passed to the function are dynamic, so there is no way to create a static list of tags CFHTTPPARAM. In fact, there are a few static parameters, but there will always be dynamic parameters that are included in the query based on the values set for the static settings.

    My question is how to pass form data in a POST CFHTTP query when the parameters that should be passed are not known in advance? I see that there is a type attribute of the CFHTTPPARAM of 'head' and 'body' tag, so I thought that it would be possible to manually build the data that are passed, but what is the right way to pass parameters to form if I build the 'head' and 'body' data myself?

    What is the problem with the dynamic tags. That's why they exist.







  • trigger for post request

    Hi gurus,

    I have two blocks Master and detail block and I wrote more trigger code query detail block post, but when I go to the next record in the main block must "do you want to save this record. How to avoid this title: order_planning.machieve_quantity is a display area.

    Select sum (achieve_quantity): image.resource_planning order_planning.machieve_quantity
    where mplan_id =: order_planning.mplan_id;

    Thanks in advance

    Sadiq

    Hello

    If I had you then try something like that.

    trigger on the message.

    :system.message_level := '25';
    

    hope this helps you.

    Sarah

  • Slow post request

    Hello

    New forms and looking for some guidance here, I have a form with a data block, this form has several fields related to the database and to display the fields.
    The values in the display fields that I recover in a trigger for post_query on the data block.

    If I check browser session I notice of course for each line found many select statements are to find the values of the display fields.

    It is, however, slow down the form to practically unusable.

    I have about 100K rows in my table, if the user tightens the criteria selection on the original of 'Find', say for a particular transaction, then the display form is almost immediate. Only problem is, they want to see all the lines of 100K, which means selects 100 * 8 (not cool!)

    database is on 10g, otherwise I would have seen if function in 11g result cache would be useful.


    How one normally would address this design, as I assume that I'm not the first person who needs the fields displayed in the form that are not in the database

    Thank you
    Scott

    Hello

    Have you tried to set the property to all query false records?

    François

  • selection of conditioned to trigger on post request

    Hey everybody,

    in a trigger after query, I do the following code:

    If: Lkw = 3 then select kz0103, kz0203 in: characteristic,: fahrer
    of r_bestellung@r
    where nummer =:k_was_verladen_vw.bestellnr;

    I can't compile

    the problem is the following:
    my opinion is supplieing the truck column with different numbers from 1 to 9. in the trigger after query I want to choose the domain kfz01 from another table in the textobject kfz if the truck is 1, in which case the value of trucks is 2 then I want to select kfz02 in the car of the textobject.

    I hope I explained good.

    concerning
    Robert

    Hello

    try according to query as shown below

    Declare

    cursor cur_r_bestelling@r
    is
    Select kz0103, kz0203
    of r_bestellung@r
    where nummer =:k_was_verladen_vw.bestellnr;
    Begin
    If: Lkw = 3 then

    Open cur_r_bestelling@r;
    loop
    search for cur_r_bestelling@r in: characteristic,: fahrer
    When the output cur_r_bestelling@r%notfound;
    end loop;
    close cur_r_bestelling@r;
    end if;

    end;

    If my answer is correct, mark it accordingly

  • cursor in a post request

    Hello
    in a trigger after query I'm filling a text non-base of data element (with items displayed = 7) with the code
    DECLARE
      CURSOR crElev IS
        SELECT name ||' '|| surname
          FROM elevi
         WHERE ID=:vw_angajati_note.id_elev order by nume;
    BEGIN
      OPEN crElev;
      FETCh crElev INTO :vw_angajati_note.elev;
      CLOSE crElev;
    END;
    but during the execution of the query, the non-base data point does not contain classified... names and I don't know why
    is it possible to order in a slider?

    Thanks in advance

    It is possible, but you do it in the ORDER BY property of the block.

    In other words there is

    (SELECT name ||' '|| surname
          FROM elevi
         WHERE ID=id_elev
    )
    
  • 100 requests to continue POST deal with error in Firefox 24

    BUG Firefox 24!
    24 Firefox manages POST requests with the error: when 100 continue answers are preceded by 200 OK response, and then Firefox does not deal with other responses (including 200 OK response) after receipt of the response to continue first 100.
    Earlier versions more handle 100 continue properly.

    I'm sorry, I tested my script with Mozilla Firefox 25 - was the same problem. But then I spilled http connection - the newspaper said then 100 response continues and 100 OK data are mixed and gzip'ped. Then I disable deflate module for my Apache Server - and all become Okey! So, I just disable the compaction modules incorrect return data to solve the problem. Web server: apache2-mpm-itk on Debian Linux winded 7.

Maybe you are looking for