Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

New Contributor
Posts: 2
Registered: ‎09-28-2012
My Device: Blackberry Bold 9900
My Carrier: 11963530183

TLSIOException when uploading files to webservice

Hi friends,


first of all sorry my poor english.


I'm facing a problem when I try to upload files under SSL.
I opened a HttpsConnection and wrote the bytes of the file in the OutputStream of the connection, but, when I tried to get the responseCode an TLSIOException throws.


Here is my code...


HttpRequestUtil request = getDefaultRequest(uri)


.addProperty("Connection", "Keep-Alive")

.addProperty("Content-Type", "multipart/form-data; boundary=" + ApiConfigurations.BOUNDARY)

.addProperty("x-rim-transcode-content", "none")

.addProperty(HttpProtocolConstants.HEADER_CONTENT_TYPE, HttpProtocolConstants.CONTENT_TYPE_MULTIPART_FORM_DATA +";boundary=" + ApiConfigurations.BOUNDARY)

.addProperty(HttpProtocolConstants.HEADER_CONTENT_LENGTH, String.valueOf(bbFile.fileSize()));




/* First we need to open the socket to write on */

OutputStream outputStream = request.getConnection().openOutputStream();


/* Writting body header */

byte[] startBody = buildStartBody(bbFile.getName());

outputStream.write(startBody, 0, startBody.length);


/* Start to read file bytes and write in the output stream */

InputStream fileInputStream = bbFile.openInputStream();


int bytesRead = 0;

int bufferSize = fileInputStream.available() < BUFFER_LENGTH ? fileInputStream.available() : BUFFER_LENGTH;

if(bufferSize == 0) bufferSize = BUFFER_LENGTH;


byte[] buffer = new byte[bufferSize];

while ((bytesRead = fileInputStream.read(buffer)) != -1) {

outputStream.write(buffer, 0, bytesRead);






/* Writting body footer */

byte[] endBody = buildEndBody();

outputStream.write(endBody, 0, endBody.length);



/* At this moment I receive an exception */


I would appreciate if you could help me in this trouble.




Posts: 152
Registered: ‎07-28-2011
My Device: Bold 9900
My Carrier: MTN

Re: TLSIOException when uploading files to webservice

Have a look at the following thread for a possible solution:



New Contributor
Posts: 2
Registered: ‎09-28-2012
My Device: Blackberry Bold 9900
My Carrier: 11963530183

Re: TLSIOException when uploading files to webservice

Thansk a lot for your reply Dionysus, but I have tried the same and did not have success.