开发者

Call REST Webservice from Blackberry

开发者 https://www.devze.com 2023-02-11 09:23 出处:网络
I am new to Blackberry app development. I need to call REST webservice from blackberry application using JDE 4.7. I searched but not got any solu开发者_高级运维tion. Anyone help pls?

I am new to Blackberry app development. I need to call REST webservice from blackberry application using JDE 4.7. I searched but not got any solu开发者_高级运维tion. Anyone help pls?

sri


You have to make an HttpConnection request and read the data as an InputStream... have a look at this tutorial Calling REST based web services


I appreciate this an old post - but it has been updated so someone is looking at it, so I thought it appropriate to contribute.

I am sorry, but I can not recommend the code supplied the link from another answer called "Calling REST based web services".

I have made a comment explaining this on the site, along the following lines:

"In my opinion this code is flawed because it does not consider the different connection methods, nor does it consider different encodings. More over it does not consider the Event Thread or provide reasonable error checking and logging. I appreciate that this is just a sample, but I think the author has a responsibility to make people who might use this code aware of how it should be used properly. And this code will cause more problems that it solves. Refer to the supported BlackBerry documentation and web sites for better samples."

Sorry, I am not as familiar as I should be of the questions asked on stackoverflow, but questions like this come up regularly on the BBRY forum here:

http://supportforums.blackberry.com/t5/Java-Development/bd-p/java_dev

I recommend that you go on that forum and type network in the Search box on that site and you be presented with a range of tutorials and KB articles that discuss all aspects of networking. In this particular case I would recommend this:

http://supportforums.blackberry.com/t5/Java-Development/What-Is-Network-API-alternative-for-legacy-OS/ta-p/614822

Networking is not trivial on the BlackBerry, do not expect a cut and paste of the code supplied to work for you. Specifically you should be aware of: a) The various connection methods, the costs associated with each and the impact that using each might have (e.g. transcoders or caching) b) The Event Thread, how to get off it and back on when processing a response c) Logging and reporting so that you can investigate problems when they occur (and they will).

Personally, given that all OS 4.7 devices can be upgraded to OS 5.0 and should be, since OS 5.0 is better, I would forget supporting OS 4.7. Instead look at OS 5.0 and above support and use ConnectionFactory.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号