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.

Tags: BlackBerry Developers

Similar Questions

  • sign the document with 'Draw my signature' and send it via http-post

    Hello

    I have a pdf document with a signature field. When im opening with AcrobatReader XI, I can sign / Place Signature / draw my signature. I can't 'save a copy '. It works pretty well.

    Now, I place a button in the pdf document to be sent via http post to a given address. When I now open this PDF in the XI AcrobatReader, trying to sign. I can only do this with sign / Place Signature / use a certificate. But there is no way to "draw my signature."

    Did I miss an option to do this? Pls tell me if he has a chance to sign the document with 'Draw my signature' and send it via http-post.

    Or is this part of the concept? When I'm looking for a solution, I found EchoSign electronic signature.

    What is available depends on how the as is put in place. If you include a button with an action of type 'Submit form' and/or reader - enable the form, then e-signature (signature of drawing) will not be available in the player. If the document is compatible player then digitally signing will. So for what you want, do not Reader-enable the document and you can use the submitForm JavaScript method to submit. The site that has the JavaScript documentation was not available at the time I wrote this, but post again if you need help with that.

  • Send a PDF form via HTTP Post: Newbie Questions

    Hello

    I am completely new to PDF forms, so I was finding the documentation and the overwhelming options.

    I'm hoping to get directed to the documentation/tutorials/examples that I really need.

    I want to build a 'proof of concept' for my boss.  I would like to include a screen in our webapp Java (JSP & spring) where either a PDF form is incorporated or is accessible via a link.

    I have

    • Standard Adobe Acrobat Distiller X license
    • Adobe Acrobat X Standard
    • Microsoft Office 2010

    I made a little, the form of Microsoft Word 3 field.  I then he converted via distill into a PDF form.

    I then found this document on how to submit a PDF form to a component side Server:

    http://acrobatusers.com/tutorials/form-submit-e-mail-Demystified

    My big problem with this document, is not an example, nor an example of what is happening in an HTML page complete.   Because I I have a few questions:

    1. I see such an example somewhere?
    2. The result of the call to the javascript function doc. SubmitForm (urlToMyServerSideComponent) go in a script tag on the HTML page as other javascripts?
    3. Can I submit the function from an HTML button run or I put a button 'send' the PDF form?
    4. Do I need Adobe LiveCycle to create a PDF form with a button "submit"?  Free versions?
    5. Can I send via HTTP POST?
    6. Do I need Adobe LiveCycle to create a PDF form with a digital signature?
    7. Is there a document/tutorial that fits where I want to? (Please no books, I am tyring to show to my boss that this is something which can be done in a reasonable amount of time, no time to get and go through a book).

    Thanks in advance for things which make me pointed in the right direction

    Steve

    This seems to imply that I can do a such acroform without using an application or can I use an application with an option to write code by hand.  Am I wrong?  If yes could tell me on the document from the beginner to learn how to do this?    I have acrobat, but I don't have the 'send to server' option in the menu to distribute.

    No, you would use Acrobat to add the button and configure. As said earier, you want not to use distribute the form for this type of shape. Simply add a button on one of the pages of the PDF and give a mouse action upward to "submit a form":

    The video tutorial contains more information on the treatment of the submission on the server. Again, do not use the option to distribute the form in Acrobat.

  • Time increasing while sending data via http repeatedly on the storm

    Hi all!

    My application sends data (in general, this is a picture of ~ 1200 Kb) to the server via http.

    The data are sent ok, but the when I send data several times (without leaving the application) the time devoted to writing the data in the outputStream develops. On first use, it takes usually ~ 50 seconds, the second seconds of ~ 70, the third seconds from ~ 100... I see this problem only on the storm, others (Curve 8900, Bold, Tour) are OK. The url is used on Storm is: http://xxxxxxxxxxxxx.com/mobile/mobile.asmx;deviceside=true

    Here is the code snippet:

    private static WSResponse send(byte[] xmlBytes, WSResponseParser parser) throws Exception {
    
            HttpConnection connection = null;
        OutputStream outputStream = null;
    
           try {
                connection = (HttpConnection)Connector.open(WifiChecker.getURL(URL), Connector.READ_WRITE, true);
    
                connection.setRequestMethod(HttpConnection.POST);
                connection.setRequestProperty("Content-Type", CONTENT_TYPE);
                connection.setRequestProperty("Content-Length", String.valueOf(xmlBytes.length));
    
                outputStream = connection.openOutputStream();
    
                int offset = 0;
                int chunk = DATA_CHUNK_SIZE; // 1024
                int len = xmlBytes.length;
                while (offset < len) {
                    if (offset + chunk >= len) { // avoiding OutOfBounds Exception
                        chunk = len - offset;
                    }
                    outputStream.write(xmlBytes, offset, chunk);
                    offset += chunk;
                }
    
                xmlBytes = null;
    
                String response = getResponseAsSting(connection);
    
                WSResponse wsResponse = null;
                try {
                    wsResponse = parser.getWSResponse(response);
                } catch (Exception e) {
                    throw ApplicationException.invalidWsResponse();
             }
    
                if (!wsResponse.isSuccess()) {
                    throw new WSFailureException(wsResponse);
                }
    
                return wsResponse;
    
            } finally {
                IOUtils.safelyCloseStream(outputStream);
                IOUtils.safelyCloseStream(connection);
                if (xmlBytes != null) {
                    xmlBytes = null; // notify VM it can safely free the RAM
                }
            }
    

    I thought it may be a memory problem, so I manually cancel xmlBytes, but which does not solve the problem.

    Any ideas?

    Thanks in advance,

    Arhimed

    P. S.

    There is no question about Simulator, only on a real device of the storm.

    MSohm, thanks for your response.

    Fortunately, I have just fixed the problem. The problem was not in the code above, but in the code that made the xmlBytes. I converted bytes of the image base64 and looks like I did it dangerously on the use of the memory.

    Thanks again for your attention to this thread!

  • Sending a file via http POST

    I can't find out how to send a pdf file to the REST API /transientDocuments. In what format is it in? What should I include in the header and the body? I can't find a clear answer.

    I thought about it! I'll post the solution for others to research.

    To send a PDF on HTTP Announces, I put the header to have the access token. However, I put the body is

    "- 011000010111000001101001\r\nContent-Disposition: form-data; name = \ 'file '; "filename = ${fileBase64} \r\nContent-Type: application/pdf\r\n\r\n\r\n - 011000010111000001101001-

    Where the variable "fileBase64" is my file that I converted to a string in Base64.

    I also put the Content-Type to be "multipart/form-data; Boundary = - 011000010111000001101001"

    I was able to understand using app postman to observe what has been sent between the Adobe server and the application. Postman also had examples of code in Java (and many other languages) which has proved invaluable when I was trying to find a solution.

    Hope this helps someone else.

  • Sending data by HTTP post

    Hey guys, I have struggled with it all morning and have tried various samples without result.

    I have a service I need to view settings and then receive JSON data back. I have questions, get the post data to pass to the service (comes empty). I can't find all the information on messages anywhere on the developer portal either.

    Here is the code for

    
        // Network manager
        mAccessManager = new QNetworkAccessManager();
           if (!mAccessManager)
           {
               qDebug() << "Unable to create QNetworkAccessManager!";
               return;
           }
    
        //  Handle SSL errors
        connect(mAccessManager,
             SIGNAL(sslErrors ( QNetworkReply * , const QList & )), this,
             SLOT(onSslErrors ( QNetworkReply * , const QList & )));
    
        // Convert to string
        QByteArray byteArrayObject;
        byteArrayObject.append("name1=value1");
        // Path to server    QString path = "http://myurl.com/post.php";
    
        // Build request
        QUrl serviceURL(path);
        QNetworkRequest request(serviceURL);
    
        // Post and connect
        mReply = mAccessManager->post(request, byteArrayObject);
        connect(mReply, SIGNAL(finished()), this, SLOT(onFinished()));
    

    Any help / suggestions would be greatly appreciated, thank you.

    I finally got this figured out.

    Missed me a few great lines:

        // For your "Content-Length" header
        QByteArray postDataSize = QByteArray::number(body.size());
    
       // Set Headers
        request.setHeader( QNetworkRequest::ContentTypeHeader,"application/json" );
        request.setHeader( QNetworkRequest::ContentLengthHeader,QString(postDataSize).toUtf8() );
    

    Here is a complete example.

       // Network manager
        mAccessManager = new QNetworkAccessManager();
           if (!mAccessManager)
           {
               qDebug() << "Unable to create QNetworkAccessManager!";
               return;
           }
    
        //  Handle SSL errors
        connect(mAccessManager,
             SIGNAL(sslErrors ( QNetworkReply * , const QList & )), this,
             SLOT(onSslErrors ( QNetworkReply * , const QList & )));
    
        // Convert to string
        QByteArray byteArrayObject;
        byteArrayObject.append("name1=value1");
    
        // For your "Content-Length" header
        QByteArray postDataSize = QByteArray::number(body.size());
    
        // Path to server
        QString path = "http://myurl.com/post.php";
    
        // Build request
        QUrl serviceURL(path);
        QNetworkRequest request(serviceURL);
    
       // Set Headers
        request.setHeader( QNetworkRequest::ContentTypeHeader,"application/json" );
        request.setHeader( QNetworkRequest::ContentLengthHeader,QString(postDataSize).toUtf8() );
    
        // Post and connect
        mReply = mAccessManager->post(request, byteArrayObject);
        connect(mReply, SIGNAL(finished()), this, SLOT(onFinished()));
    
  • Connect in HTTP-Post

    Hello

    am I right if I think that it is not possible to connect to rwservlet via http-post, only http-get.
    And that's the reason why I get REP-56048 when I try?

    Thank you.

    Concerning

    Chris

    Hi Chris,
    Take a look at the code in the following document can help.

    Reference
    REP-0788 warning message when the report with a form of parameter of the HTML form on the web (Doc ID 359819.1)

    Best regards, RZ

  • Failure of HTTP post when connecting via SIP

    Hi all

    I'm doing HTTP post, but I get corrupted in the response data.

    This problem only occurs on the device (4.5) and only if you use the SIP configuration

    (the problem does not when you use a device via Wifi 4.6)

    Here is my code:

    HttpConnection connection = (HttpConnection)Connector.open(url + ";deviceside=false");connection.setRequestProperty("x-rim-transcode-content", "*/*");connection.setRequestMethod(HttpConnection.POST);connection.setRequestProperty("Content-Type","multipart/form-data; boundary=@---------------------------123");connection.setRequestProperty(HttpProtocolConstants.HEADER_CONTENT_LENGTH, String.valueOf(data.length));      OutputStream os = connection.openOutputStream();os.write(data);
    
    if (connection.getResponseCode()==HttpConnection.HTTP_OK){   StringBuffer result = new StringBuffer();   byte[] buffer = new byte[2000];   int i = 0;         DataInputStream in = connection.openDataInputStream();
    
       while ((i = in.read(buffer)) != -1){      result.append(new String(buffer, 0, i,"ISO-8859-1"));   }}
    

    Does someone know what I'm doing wrong here?

    (BTW, the system cut the suffix HTTP "ConnectionType =" which should be equal to "mds" + "»' + 'public')

    I guess that your assumption that the "transcode-including" in the request header method caused the problem was correct.

    I changed the method request header, it shows the HttpConnection API:

    ...
    
    // Set the request method and headers
    c.setRequestMethod(HttpConnection.POST);
    c.setRequestProperty("If-Modified-Since","29 Oct 1999 19:43:31 GMT");
    c.setRequestProperty("User-Agent","Profile/MIDP-2.0 Configuration/CLDC-1.0");
    c.setRequestProperty("Content-Language", "en-US");
    
    ...
    

    and the problem has been corrected

  • Getting 7 error with the HTTP POST vi method when deplyed ISO crio as executable... urgent!

    Hi all

    I have an application where I can access the net server point of LabVIEW via the HTTP protocol to send the data. My application works fine when I run it on XP, and also sometimes on cRIO. I'm writing and reading files to store and read data from the server.

    When I do my application executable and deployed on cRIO I am constantly 7 error that says "Error in the node library function to call at the POST vi LabVIEWHTTPCLIENT".

    After getting this error if I try to run the my new project the crio (not through exe) I keep getting the same error. This means once the executable file is deployed on the crio, I get the error in my project application which was working fine before you deploy the executable file.

    7 occurs very frequently. and I am unable to find the reason. I gave all the paths in the constant form located on crio and files accessible also when the application is run.

    Is someone can you please help me what this error 7?

    as a result, that it is bound to the HTTP POST vi method...

    How can it be fix?

    Its quite urgent...

    Thanks in advance.

    Solution is provided by the NOR... Vi POST method missing two files that need to be there in the startup of the CRIO.insted folder there is in the system folder. That's why when running the exe that the startup on crio application it gives error as the files are not there. The fix for this HTTP POST vi update isn't out yet EITHER.

  • Error when, with audio streaming via HTTP to the Simulator

    I use JDE 4.7 and 8900 Simulator.  I'm trying to listen to an MP3 via http to a blackberry app.  When you use the BufferedPlayBack example screen, I get the following error when the data source is trying to open the connection - "net.rim.device.cldc.io.dns.DNSException: error trying to solve.

    When I enter the same URL in the BlackBerry browser on the Simulator, I get the following error: "the selected server returned an error when you try to respond to your request.

    When I enter the same URL in my web browser in my PC, I am able to stream audio and play with QuickTime.

    Why I get this DNSException on the BB and not on my local PC?  The web engine runs also locally.  I know that the BB Simulator does not support rstp.  The Simulator also not does support streaming over http?

    This is the URL I used:

    http://myLocalMachine:8080/myMusic/anAudio.MP3;deviceside=true

    Thanks in advance!

    T

    I found a solution to the question in the thread below.  I increased the connection. MaxNumberOfKBytesToSend = 10240 in the... File MDS\config\rimpublic. Property and so was able to sucessfully stream mp3 to my request.

    http://supportforums.BlackBerry.com/T5/Java-development/increase-MDS-CS-limit-on-http-download-size/...

  • 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.

  • 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/

  • How to rename a data via command store during automatic installation

    Hi, the automatic installation of my servers esx and post script exec I wan't to rename the local data store to esx 3.5. I tried to find a solution here in communities and also tried the following commands

    • vimsh - n e "datastore/hostsvc / / rename oldname newname.

    • VMware-vim-cmd hostsvc/datastore/rename oldname newname.

    but nothing happens when I use these commands and I get no error message.

    Anyone know what I am doing wrong and how can I rename local warehouses of data via command line?

    Thankx

    Frank

    We have a set of post scripts that are executed after the first reboot after the construction, by default the local data store must be named storage1

    You can do the following:

    ln -sf $(readlink -f /vmfs/volumes/storage1)  /vmfs/volumes/$(hostname -s)-local-storage
    

    or of any naming convention you want

    =========================================================================

    William Lam

    VMware vExpert 2009

    Scripts for VMware ESX/ESXi and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

  • HTTP POST: Returns a response of login instead of a JSON response page

    Dear all,

    I just glued a snippet of code for HTTP Post where I WRITE a message to multiple parties to the server that will
    Authentication. I expect a response the following JSON. But when I run the present I always LOGIN
    Page in HTML.

    Can someone let me know the problem in the code below...

    Thanks a ton for your help.

    Thank you
    MGR

    / public final class MyScreen extends form {}
    private RichTextField _Output;
    public MyScreen() {}
    Set the displayed title of the screen
    setTitle ("MyTitle");

    _Output = new RichTextField();
    Add (_output);
    addMenuItem (_GetDataAction);
    }
    protected _GetDataAction MenuItem = new MenuItem ("GetData", 100000, 10) {}
    public void run() {}
    String URL = "";
    ServiceRequestThread svc = new ServiceRequestThread (URL,
    (MyScreen) UiApplication.getUiApplication)
    (. getActiveScreen());
    SVC. Start();
    }
    };
    {} public void updateDestination (final String text)
    UiApplication.getUiApplication () .invokeLater (new Runnable() {}
    public void run() {}
    _Output.SetText (Text);
    }
    });
    }

    }
    class ServiceRequestThread extends Thread {}

    protected String _URL;
    protected MyScreen _Dest = null;
    protected URLEncodedPostData _PostData = null;
    StringBuffer writer = new StringBuffer();

    {} public void setPOSTData (URLEncodedPostData data)
    _PostData = data;
    }

    public ServiceRequestThread (String URL, display MyScreen) {}
    Super();
    Dest = screen;
    _URL = URL;
    }

    public void run() {}
      
    Try
    {
    String limit = "SATBA";
    String twoHyphens = "-";
    "{String data1 = '{\"IMPORTING\': {\"IN_COUNTRY_CODE\":\"US\'}} ';
    String CRLF = "\r\n";
    Byte [] encrypted = Base64OutputStream.encode ("Userassword".getBytes (), 0, "userassword".length (), false, false);
           
    "Preparing the post data.
         
    Writer.Append ("-" + boundary) .append (CRLF);
    Writer.Append ("Content-Disposition: form-data;") Name = ()-"param\" ")." Append
    CRLF);
    Writer.Append ("Content-Type: text/json;") charset ="+" UTF - 8 ") .append (CRLF);
    Writer.Append ("Content-Transfer-Encoding: 8 bit") .append (CRLF);
    Writer.Append ("request - ID:Abcd123456"). Append (CRLF);
    Writer.Append("request-type:rfc_json"). Append (CRLF);
    Writer.Append ("Function:00163E0136C01EE0AE8B059433A71727")
    . Append (CRLF);
    Writer.Append (CRLF);
    Writer.Append (data1). Append (CRLF);
    Writer.Append("--" + Boundary + "--"). Append (CRLF);
    String string = new String (writer);
                           
    HttpConnection conn1 = (HttpConnection) Connector.open (_URL, Connector.READ_WRITE);
    conn1.setRequestMethod (HttpConnection.post);
    conn1.setRequestProperty ("authorization", "Basic" + new String (encoded));
    conn1.setRequestProperty ("Content-Type", "multipart/mixed; limit =" + limit);
     
    OutputStreamWriter osw is new OutputStreamWriter (conn1.openOutputStream (), 'UTF-8');.
    OSW. Write (String);
    OSW. Flush();
    OSW. Close();
       
    int responseCode = conn1.getResponseCode ();
    If (responseCode == HttpConnection.HTTP_OK) {}
    Given InputStream = conn1.openInputStream ();
    Gross StringBuffer = new StringBuffer();
    Byte [] buf = new byte [4096];
    not read int = data.read (buf);
    While (not read > 0) {}
    RAW. Append (new String (buf, 0, read));
    not read = data.read (buf);
    }
    _Dest.updateDestination (RAW. ToString());
    } else {}
    _Dest.updateDestination ("responseCode ="
    + Integer.toString (responseCode));
    }
    }
    catch (IOException e)
    {
    e.printStackTrace ();
    _Dest.updateDestination("exception:"+e.ToString());)
    }
    }

    }

    Hello

    Thank you very much code was perfectly fine and she is on property rim.public of the file where the

    application.handler.http.AuthenticationSupport has been set to true, and because of this in the fact that he wasn't loggging.

    Now I put it to false, and the correct answer came.

    Thank you very much.

    Best regards

    MGR

  • HTTPS post doesn't work on device but in the Simulator

    You are looking for suggestions on why a https post works all the time on a simulator, but what installation on the device and test it works the first time but the time the rest of the time after that.

    Here is most of the code, this came from another sample written and posted on BB forums.

    I tried with the removed ConnectionTimeout, and with it the value of different values.

    As mentioned it works the first two times, maybe even just the first time and not after once using the real device.

    Any thoughts would be greatly appreciated.

    private String of doTransaction (postString String)]
    {
    String [] ccResponse;
    HttpsConnection SC;
    OutputStream outStream = null;
    String url = "https://url/; ConnectionTimeout = 60000 "; just removed the url to view the code

    Try
    {
    HC = (HttpsConnection)
    Connector.Open (url, Connector.READ_WRITE); Set the POST request method
    hc.setRequestMethod (HttpsConnection.POST);
    hc.setRequestProperty ("Content-Type", "application/x-www-formulaires-urlencoded");
    hc.setRequestProperty ("Content-Length", Integer.toString (postString.length ()));

    outStream = hc.openDataOutputStream ();
    outStream.write (postString.getBytes ());
    outStream.flush ();
    outStream.close ();
    Get the answer back to the servlet
                
    hc.getResponseCode ();
                
                
    InputStream is = hc.openDataInputStream ();
    LineReader lr = new LineReader (is);

    While (true)

    {
    Try
    {
    Byte [] arr = lr.readLine ();
    String $thisline = new String (arr);
    Dialog.Inform ($thisline);
    If (! thisLine.endsWith ("="))
    {
    Dialog.Inform ("splitting");
    If ends with =, not split
    String [] splitLineResponse;
    String separator = '=';
    splitLineResponse = split (new String (arr), separator);

    String responseItem = splitLineResponse [0];
    String responseValue = splitLineResponse [1];

    There are a lot of topics split here.

    }
                        
                            
    }
    catch (e EOFException)
    {
    Reached end of file
    Dialog.Inform ("expressions of folklore Exception" + e.getMessage ());
    break;
    }
    }
    HC. Close();
                
    }
    catch (Exception ex)
    {
    Transaction time-out
    Dialog.Alert ("TransException" + ex.getMessage ());

    }
    postData = null;
    Return ccResponse;
            
    }

    How is it a failure?

    My guess is that the problem is that the unit does not have a connection. Without any connection parameter, it will connect via MDS if the device is a network of MDS; If not, he'll probably try direct TCP. In the latter case, it will fail unless the APN settings are set correctly. The carrier may also have something to say about it.

    I suggest you read the post-it by Peter Strange and also check out the videos of transport network that RIM posted. They provide a lot of information on how to establish connections.

Maybe you are looking for