is an HTTP Post possible using webworks/widget SDK or what I should use Java widget?

Hi all

I use webworks and widget SDK to make a simple application where I need to do the following

(1) open a site called www.mytest.com

(2) display the following parameters with the request to open the site

Login = true

UserID = one

password = b

Is this possible using BlackBerry Widget SDK? I looked at the blackberry.invoke.BrowserArguments and I do not think that it allows that.

 

Is this a limitation to the use of webworks? If so, that is the only alternative is to develop a widget of java and use the browser2 field?

 

Thank you

Parag

Yes, you can...

When you make an Ajax request, on your call to the open() of XMLHttpRequest objects method use the following:

XMLHTTP. Send ('post', URL, true);

XMLHTTP. Send (post_string);

WHERE

'post': your request method

URL: the url to which the http request you

true: to make it asynchronous (Note: this is the default behavior)

post_string: is a urlencoded string containing all your post variables and their values like this

"xc =" + encodeURI (element.value) + '& xd =' + encodeURI (element2.value)...

You should be fine here as long as you know how to create an XMLHttpRequest object and can use GET, this should be familiar.

Tags: BlackBerry Developers

Similar Questions

  • Authentication http post VI errors

    I am trying to query a web service to third parties non-LabVIEW LabVIEW 2014, using HTTP POST. Using another utility (restclient-ui-3.5-jar-with-dependencies.jar), I checked that URL, user name, password, and query syntax are accurate and are running on the same computer where my VI fails. I must be missing something when translating that to LV, because I get the error 401 (full authentication is required) and also 415 (unsupported media type).

    I have attached the configuration file used for the other utility, my VI and an overview of the response from the Web service for the post of the VI.  I had to make all anonymous, hide url, user, etc., so it can not really be tested as it is, unfortunately. I tried with & without additional authentication header, with & without Config SSL, etc. You can see the different options on the VI.

    Any suggestions?

    Thank you very much.

    Solved my problem with a combination of different required headers and syntax fixes.

  • Problem when using SOAP requests with HTTP POST function

    Hello!

    Using the vi of HTTP POST to send SOAP requests to a device, I encountered a problem.

    Take care of the HTTP header for you HTTP POST vi and defines the type of 'content' as "Content-Type: application/x-www-formulaires-urlencoded. Who is considered to be 'non-soap' requests by some Web servers.

    Standards W3C says in this case, you should be content-type: "application/soap + xml".

    Link to the page to W3C standard: http://www.w3.org/TR/soap12-part0/#L26866

    That is possible to update this feature in a future release so that programmers can choose (or type) the necessary content type?

    Have you tried "Add header" to change?

    http://zone.NI.com/reference/en-XX/help/371361L-01/lvcomm/http_client_addheader/

  • Sending parameter using the METHOD (HTTP POST = PROBLEM WEBSERVICE)

    Hello world

    I need help here

    I tried 1 week to the code to send the parameter but the error still result

    It sends no parameter at all the

    Heres my PPC

    ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
            QObject(app)
    {
    
        m_pTranslator = new QTranslator(this);
        m_pLocaleHandler = new LocaleHandler(this);
    
        bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()));
        // This is only available in Debug builds
        Q_ASSERT(res);
        // Since the variable is not used in the app, this is added to avoid a
    
        Q_UNUSED(res);
    
        onSystemLanguageChanged();
    
        QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    
        qml->setContextProperty("MyApp",this);
        // Create root object for the UI
        AbstractPane *root = qml->createRootObject();
    
        // Set created root object as the application scene
        app->setScene(root);
    }
    
    void ApplicationUI::post(const QString &fullName, const QString &email, const QString &password)
    {
        QNetworkAccessManager connection;
    
        QUrl url("http://www.rws.rajaspot.com/rs_usermanagementclient.php");
        QNetworkRequest req(url);
        //url.addQueryItem("parameter", "14");
    
        QByteArray postData;
    
        postData.append("method=rsnewuser&").append("fullName="+fullName).append("email="+email).append("password="+password);
    
        QNetworkReply* reply = connection.post(req, postData);
        bool ok = connect(reply, SIGNAL(finished()), this, SLOT(postFinished()));
        Q_ASSERT(ok);
        Q_UNUSED(ok);
    
    }
    
    /**
     * PostHttp::onGetReply()
     *
     * SLOT
     * Read and return the http response from our http post request
     */
    void ApplicationUI::postFinished()
    {
        QNetworkReply* reply = qobject_cast(sender());
    
        /* QString response;
        if (reply) {*/
            if (reply->error() == QNetworkReply::NoError) {
                QString result = reply->readAll();
    
                /*const int available = reply->bytesAvailable();
                if (available > 0) {
                    const QByteArray buffer(reply->readAll());
                    response = QString::fromUtf8(buffer);
                }*/
            } else {
                int errorCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
                qDebug() << errorCode << endl << reply ->errorString();
            }
    
            reply->deleteLater();
        }
    
    void ApplicationUI::onSystemLanguageChanged()
    {
        QCoreApplication::instance()->removeTranslator(m_pTranslator);
        // Initiate, load and install the application translation files.
        QString locale_string = QLocale().name();
        QString file_name = QString("UsernamePHP_%1").arg(locale_string);
        if (m_pTranslator->load(file_name, "app/native/qm")) {
            QCoreApplication::instance()->installTranslator(m_pTranslator);
        }
    }
    

    Heres my hpp

    #ifndef ApplicationUI_HPP_
    #define ApplicationUI_HPP_
    
    #include 
    
    namespace bb
    {
        namespace cascades
        {
            class Application;
            class LocaleHandler;
        }
    }
    
    class QTranslator;
    
    /*!
     * @brief Application object
     *
     *
     */
    
    class ApplicationUI : public QObject
    {
        Q_OBJECT
    public:
        ApplicationUI(bb::cascades::Application *app);
        virtual ~ApplicationUI() { }
    public:
        Q_INVOKABLE void post(const QString &fullName, const QString &email, const QString &password);
    
      Q_SIGNALS:
                void complete(const QString &info);
      private Q_SLOTS:
                void postFinished();
    
    private slots:
           void onSystemLanguageChanged();
    
    private:
        QTranslator* m_pTranslator;
        bb::cascades::LocaleHandler* m_pLocaleHandler;
    };
    
    #endif /* ApplicationUI_HPP_ */
    

    and this is my my main.qml

    Button{
                id : button
                text : "Register"
                onClicked: {
                   MyApp.post(tf1.text,tf2.text,tfpass.text)
    
                }
                horizontalAlignment: HorizontalAlignment.Center
            }
    

    I need to send the parameter to http://www.rws.rajaspot.com/rs_usermanagementclient.php

    but its like divider by 2, the parameter 'method = rsnewuser' and the content is fullName, email, and password

    What a success, it will show on http://www.rws.rajaspot.com/rs_userclient.php but I try this error code again

    any ideas what should I do?

    Thank you

    I mean not to define QNetworkAccessManager inside the function.

    For example:

    Declare the pointer to QNetworkAccessManager in your header file (all)

    QNetworkAccessManager *connection;
    

    and then set it in the constructor of the app inside the function you or you. In the second case, you must remove QNetworkAccessManager pointer after postFinished. (connection-> deleteLater())

    connection = new QNetworkAccessManager(this);
    

    and the full code of the POST function

    ...post(const QString &fullName, const QString &email, const QString &password)
    {
        QUrl url("http://www.rws.rajaspot.com/rs_usermanagementclient.php");
    
        QUrl postParams;
        postParams.addQueryItem("method", "rsnewuser");
        postParams.addQueryItem("fullName", fullName);
        postParams.addQueryItem("email", email);
        postParams.addQueryItem("password", password);
    
        QNetworkRequest req(url);
        req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
    
        QNetworkReply* reply = connection->post(req, postParams.encodedQuery());
        bool ok = connect(reply, SIGNAL(finished()), this, SLOT(postFinished()));
        Q_ASSERT(ok);
        Q_UNUSED(ok);
    }
    

    It may be useful

     

  • WebWorks widget navigation mode work only not in ripple or Phone Simulator

    Hi, this is my first Bb Widget/WebWorks app, and I am currently having problems with the navigation mode.  Basically, it does not ripple, or in the simulator of v6.0 9700 device or on a real device of 9700 after packaging and signing of the package.

    I have read the documentation on the official website of WebWorks on the use of navigation mode:

    http://devBlog.BlackBerry.com/2010/05/BlackBerry-widget-navigation-mode/

    https://bdsc.webapps.BlackBerry.com/HTML5/documentation/ww_developing/rim_navigation_element_1582456...

    https://bdsc.webapps.BlackBerry.com/HTML5/documentation/ww_developing/using_the_navigation_mode_1866...

    I find these forums and found a how to on a policy which could have disabled Javascript on the phone, but my camera is not a policy, and it is not connected to a corporate server.

    Here are the contents of the config.xml file.


    http://www.w3.org/ns/widgets ".
    "xmlns:RIM ="http://www.blackberry.com/ns/widgets"
    version = "2.3.0.9".
    RIM: header = "" Widget-RIM: RIM/widget ">"
        
        
     
      nnn
      nnn - nnn
      ipsom
      <>committees mode = "auto" / >
     
     
     
     

    The application uses nine HTML files, including the file index.html.  Here is an excerpt of the file index.html.

    To check widget works, I have included this javascript call to display the name of the application from the config.xml file, and when the page appears in the training, the Simulator or on the device, the name of the application appears.

    The index.html page provides a list of items that have a link to the other pages.  Here is a sample of some of the links.  According to the documentation of WebWorks, the element will automatically receive focus when the user navigates to the screen in the application.  Just to be safe, I've added option, x-blackberry-Focus = "true" to some of the links to try to force the focus navigation, but it does not work.

    AAA

    BBB

    CCC

    Essentially, when the application loads in Wellington, I can navigate the application because the training allows me to use the mouse pointer in Windows to control what is on the screen of the virtual device.

    When I package, sign and load the application on the Simulator, the Windows mouse pointer is of no use in the Simulator, so at the start of my application, I try to use the cursor keys to navigate through the page, but the elements do not receive focus.  Of course, the cursor keys work in the Simulator, because they move the cursor autour, let me choose the icons etc.

    The only way I can get a pointer to appear in my app is when I press the menu button on the simulated phone and choose the Select option, which then displays a text on-screen cursor, and then moving the trackpad, the cursor becomes a pointer that I can move and then click a link properly following the href attribute.

    I loaded the application signed on my device and the behavior is exactly the same with the Simulator.  I must be doing something wrong because I searched with Google and have not been able to find similar experiences.  My config.xml file is missing a value?

    I'm sorry, I should have said something too.  Ripple itself does emule not the trackpad navigation.  So, you won't see focus moving in your content when you try to interact with the trackpad (it does nothing).

    However the Simulator certainly should allow you to test this feature.

    Is the snippet of code provided here work for you?

    https://bdsc.webapps.BlackBerry.com/HTML5/documentation/ww_developing/using_the_navigation_mode_1866...

  • HTTP post with SSL v3

    Hello

    I use Orchestrator version 4.2.1 build 555

    And I do an HTTP Post to a server that only accepts SSL v3

    The code is easy:

    //Auto-generated script
    var urlObject = new URL(url);
    result = urlObject.postContent(content) ;
    

    But that's what I get as error:

    HTTP GET error: sun.security.validator.ValidatorException: building way PKIX failed: sun.security.provider.certpath.SunCertPathBuilderException: could not find the path of valid certification for target asked

    If I do a post manual to this url with the content of the message succeeds.

    Is it possible that the Orchestrator can only use SSL v2?

    And is there a way I can make the post HTTP messages with SSL3

    This is not the right place to import the certificates from the remote host.

    Please open the vCO Web Configurator, go to the tab 'network' (not 'server certificate' tab), and then select the 'SSL Trust Manager' tab in the right pane.

    There is a labeled text box "URL from which import a certificate". Provide the remote host/port (IE. ( https://10.23.30.40:8281), and then click the "Import" button on the right. Then restart the vCO server and try again the POST.

  • When a box has been checked (onclick event) HTTP post?

    Is it possible to make a post http for each event onclick on the boxes?

    I need to display data with parameters to an API or something that can be sent in an HTTP post.

    OK, just wanted to make sure. Take a look at the Net.HTTP object. It has a single method, application, which allows to you providing a HTTP request such as GET, POST, etc. But read the documentation, there are some serious limitations on this method. The a key being i.e. must be run from a script to the folder level.

    Alternatively, you can use the app.launchURL () method to open a web page. The user will need to enable it, if.

  • Simple HTTP post

    Does anyone know of a document/tutorial that shows you how to make a post of simple http form from a flex application?
    I guess it's possible to do a http post to a ColdFusion page that uses only the usual FORM variables to receive the data.

    After seeing this it would make life a lot easier to create "rich forms" in flex instead of DHTML, javascript & CSS.

    I see many examples of data by pulling in a flex front end, but not much focus on sending data.

    See you soon

    Simon

    I took this example and he wrote style CF.

    Works like a charm...

    See you soon...

  • A form of Google with http POST VI

    Dear LabVIEW forum,

    I'm filling out a very simple form of Google consisting of 4 text fields named AI0 AI1, AI2 AI3.

    I use the http POST provided by LabVIEW VI:

    When I run this, a new row is added to the answer sheet, but values do not appear, with the exception of the timestamp.

    What I am doing wrong?

    Thank you!

    Hello

    I had a quick look at the form and text next to the entry boxes is AI0... but the names of the input text boxes aren't AI0 etc.. You may need to get the page first and then scan the page for the name of the entry.

    Mike

  • http post does not

    I'm setting up a http post in my Blackberry app. I have successfully implemented this in my Android app, so I know the server function find. I tried several different things, and I don't really get errors, it's just that the info on the server is not updated. I looked at this post: Http POST in BlackBerryand many others. I found them useful, but they ultimately do not solve my problem. Yet once, I get errors, but the server is not updated. Here is the code that I currently use:

            String url =http://xxxx.com/ratings/add?;deviceside=tru;
            String postStr1 =business_id=79;
            String postStr2 =rating=;
    
            HttpConnection httpConnection = (HttpConnection) Connector.open(url);
            httpConnection.setRequestMethod(HttpConnection.POST);
            httpConnection.setRequestPropertyContent-Typ,application/x-www-form-urlencode);
    
            URLEncodedPostData encPostData = new URLEncodedPostDataUTF-, false);
            encPostData.appendbusiness_i, String.valueOf(790));
            encPostData.appendratin, String.valueOf(4));
            byte[] postData = encPostData.toString().getBytesUTF-);
    
            httpConnection.setRequestPropertyContent-Lengt, String.valueOf(postData.length));
    
            OutputStream os = httpConnection.openOutputStream();
            os.write(postData);
            os.flush()
    

    All ideas

    He solved. Had to remove deviceside = true

  • HTTPS post problem

    Hey guys I have problems to send data to a back-end server. I am trying to send the data using the http post method. Now, the connection works fine, her gives me a 200 OK response, after which I try to write data. But unfortunately the server receives all the data. My code is as follows:

    String toSend = "write it to the server";

    Byte [] postData = toSend.getBytes ();

    c = (HttpsConnection) Connector.open ("https://myurl;deviceside=true");

    c.setRequestProperty ("Content-Type", "application/x-www-formulaires-urlencoded");
    c.setRequestProperty ("Content-Language", "en-US");
    c.setRequestProperty ("Content-Length", String.valueOf (postData.length));
    c.setRequestMethod (HttpConnection.POST);
    int responseCode = c.getResponseCode ();

    dStr = new DataOutputStream (c.openOutputStream ());
    dStr.write (postData);

    dStr.flush ();
    dStr.close ();

    c.Close ();

    Am I missing something here? Help would be greatly appreciated.

    Thank you

    David

    Get rid of the flush.

    do the "getResponse" before closing the stream. This void anyway.

    Like this:

    Set the properties of the application
    setRequestProperties (m_httpConnection);
                           
    dataOutputStream = m_httpConnection.openDataOutputStream ();
    writeRequestPayload (dataOutputStream);
       
    get and store the response for this request code
    m_responseCode = m_httpConnection.getResponseCode ();

    Now you can close the stream

  • JDK6 only agreed to develop html5 applications using webworks BB SDK 2.3.1.5?

    JDK6 only agreed to develop html5 applications using webworks BB SDK 2.3.1.5?

    That is right. In addition to this it must be 32-bit and, further, I had a few problems with JDK6 update 45 recently. See this thread for more details:

    http://supportforums.BlackBerry.com/T5/Web-and-WebWorks-development/BlackBerry-WebWorks-SDK-2-3-1-5-...

  • 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

  • Http post: post body contains less bytes specified by the length of the content

    Hello

    in my application, I do a http post using this code (fieldsToSend and referentiToSend are both initialized before vector)

    HttpConnection conn = null;
    InputStream is = null;
    OutputStream os = null;

    Conn = (HttpConnection), Connector.open (Constants.Synch.URL_NOTIFY);
                
    conn.setRequestMethod (HttpConnection.POST);
                
    URLEncodedPostData post = new URLEncodedPostData ("UTF - 8", false);

    for (int i = 0; i)< fieldstosend.size();="" ++i)="">
    String name = "visited" + (i + 1);
    String value = (String) fieldsToSend.elementAt (i);
    post. Append (name, value);
    }
                
    for (int i = 0; i)< referentitosend.size();="" ++i)="">
    String name = "contact" + (i + 1);
    String value = (String) referentiToSend.elementAt (i);
    post. Append (name, value);
    }

    conn.setRequestProperty ("Content-Type", post.getContentType ());
    conn.setRequestProperty ("Content-Length", (New Integer (post.getBytes () .length)) m:System.NET.SocketAddress.ToString ());
                
    OS = conn.openOutputStream ();
    OS. Write (post. GetBytes());
    OS. Flush();
                
    Int State = conn.getResponseCode ();

    If (status == HttpConnection.HTTP_OK) {}

    do something

    }

    If I'm reading the server log I see this error

    SRTServletReq E SRVE0133E: an error occurred during parsing of the parameters. java.io.IOException: SRVE0216E: body of the message contains less bytes specified by the length of the content

    Can you tell me where is the problem?

    Thanks in advance.

    Kind regards

    Gianni.

    Apologies... The problem was on the servlet, not on the BlackBerry. I'm sorry too...

  • OutofMemoryException/EOFException when bleow data via HTTP POST

    Hello

    I got OutofMemoryException when I download data with size larger than 2 MB. I use http post by specifying

    'Content-Type', ' multipart/form-data; Boundary = boundaryvalue.

    in the header of the request.

    The stacktrace of the exception of 9000 "BOLD" is as below.

    No detail message

    net_rim_cldc (4AAABCA5)

    DataBuffer

    ensureBuffer

    0 x 3690

    net_rim_cldc (4AAABCA5)

    DataBuffer

    To write

    0x3C52

    net_rim_crypto_1-3 (4AAAC974)

    TLSOutputStream

    To write

    0x45C7

    net_rim_cldc-1 (4AAABCA5)

    DataOutputStream

    To write

    0x221D

    net_rim_os-2 (4AAAC894)

    ClientProtocol

    0x1A1D

    net_rim_os-2 (4AAAC894)

    ClientProtocol

    writeRequest

    0 x 1422

    net_rim_os-3 (4AAAC894)

    HttpProtocolBase

    transitionToState

    0x33D7

    net_rim_os-2 (4AAAC894)

    ClientProtocol

    transitionToState

    0x23D4

    net_rim_os-3 (4AAAC894)

    HttpOutputStream

    Rinse

    0x334C

    ....

    When I test Simulator 8300, I got EOFException.

    No detail message
    net_rim_os-2
    ClientProtocol
     
    0 x 1917
    net_rim_os-2
    ClientProtocol
    readResponse
    0x148A
    net_rim_os-3
    HttpProtocolBase
    transitionToState
    0 x 1613
    net_rim_os-2
    ClientProtocol
    transitionToState
    0 x 2335
    net_rim_os-3
    HttpOutputStream
    Rinse
    0x157E

    ...

    This code seems to work for the file with a size less than 2 MB.

    Any suggestions would be very appeciated.

    Thank you

    Itthipon

    I was able to replicate that when you use an OutputStream.  OutputStream to DataOutputStream switching enabled me to show 3 MB of data.  Please give that a try and making me know if you encounter other problems.

Maybe you are looking for

  • COKE ON MACBOOK AIR

    HELPPPPP. I spilled coke on my macbook air and immediately handed and dry. Then I took out the keys cleaned with alcohol and water and cleaned as much as I could and put it on a fan at night now its don't turn only not on helppppppp. HOW MUCH WILL TH

  • Update KB951847 and KB936330 appear to install correctly, but still appear as available

    I recently reinstalled Windows Vista from an HP recovery partition and tries to get all the available updates installed. Update KB951847 KB936330 are listed according to availability, then appear to install almost instantly when I select the. However

  • System screen shows black with the cursor after starting with no other course

    My Dell 1520 with vista home premium to int insptrion black screen after the user connection commissioning and hanga at that time here.

  • Error "Not implemented" tones book/print lab

    Hello all, back haha, same script.Every once in a while I would get an error unimplemented when I tried to print. I was able to reduce to exactly what was causing the problem, the tasks of the coatings library solid pantone. These tasks are color boo

  • I only need content details of my code

    HelloSee collected than the details of master page text to down the code using Indesign javascript:If (master [i] .parentPage .textFrames [j]! = null){"content +="------"" master [i] .name + "------",-"" + master [i] [j] .silence + "\"\r "; .textFram