Welcome!

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

Reply
Regular Contributor
erAjayGoyal
Posts: 97
Registered: ‎04-19-2012
My Carrier: *

Pass data in the body of HttpConnection using blackberry?

Hi Guys,

For Mobile app, we are using the back end salesforce service to get data, server had a service to receive data from the client in the body of the http request. Here to send data from the BlackBerry to the body of the http, we need to make use outputstream of the http connection as below code, whereas in android we can use of apache http client library to send data in the body of http using *setentity* method. i request you to provide me any library like apache http lib or any solution to achieve this either in client or in server.

byte [] bodyBytes = getBodyBytesFromSomewhere();
OutputStream out = httpConnection.openOutputStream();
out.write(bodyBytes);
out.flush();
out.close();

Thanking you

Please use plain text.
Developer
maadani
Posts: 729
Registered: ‎05-04-2011

Re: Pass data in the body of HttpConnection using blackberry?

Hi @erAjayGoyal,

 

Check out this link:

http://www.blackberry.com/developers/docs/5.0.0api/javax/microedition/io/HttpConnection.html

and look for the POST example.

 

Also, I recommend you try and use the search box in the forum as this question was asked many times and there are several examples.

 

Hope that helps,

 

E.

Please use plain text.