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
New Contributor
Posts: 5
Registered: ‎09-01-2009
My Device: Storm 9500

populate objectchoicefield from web service?

Hi all,

 

i'm writing a java app for the bb storm on os 4.7, and was wondering if anyone could answer this question. If this has already been addressed, feel free to tell me off Smiley Wink

 

I have an objectchoicefield dropdown list, and i'd like to know if it's possible to populate it from a web service as opposed to hard coding the values in?

 

i'm not very familar with java, so any help would be greatly appreciated.

 

thanks

Developer
Posts: 395
Registered: ‎12-18-2008
My Device: BlackBerry Torch 9800
My Carrier: AT&T

Re: populate objectchoicefield from web service?

Beginning with BlackBerry Device Software 4.3, RIM added support for consuming Web Services from a Java application. They basically did an implementation of the JSR 172 specification. So basically, yes - you can use the results of a web service call to pupulate interface objects.

 

You can find an example of how to consume a web service from a BlackBerry Java application here:

 

http://johnwargo.com/index.php/BlackBerry/dbja2.html
http://johnwargo.com/index.php/BlackBerry/bbdja3.html

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: populate objectchoicefield from web service?

Quite possible, however until you get the values down from the web (which might take sometime, especially if the user is not a good network area, you will not have any data to display to the user.  What are you going to do in this circumstance?

New Contributor
Posts: 5
Registered: ‎09-01-2009
My Device: Storm 9500

Re: populate objectchoicefield from web service?

 

that's a good question Peter, I hadn't thought of that.

 

I can display a dropdown from the web service in a simpleweb page displayed in Google Chrome on my laptop, so was going to link directly to the page stored within the java app, but when i load the page onto my storm,  it doesn't show the dropdown.

 

I have to admit, i'm not exactly brilliant at web coding either, so if you'll indulge me, that'd be great. the link to the web service ends in .aspx. I can display the dropdown on the storms browser if i go directly to the web address, so can't figure out what i'm doing wrong with the page i've written. the code for the page is below. i'm wondering if i'm doing something wrong with the java script.

 

I know this has turned from a java to a web query, but i'll be launching this from within a java app, so it's still sorta relevant (i hope)

 

<Html>
<title>test</title>
<head><p>test</p></head>
<body>

<h2>Now Showing...</h2>


<div class="cinemasearchMain"> 
<div> 
  <form> 
    <label><strong>Film Title: </strong></label> 

    <script type="text/javascript"> 
            document.write("<script type=\"text/javascript\" charset=\"utf-8\" src=\"web service address.aspx" + location.search +"\">" + "<" + "/script>");
    </script>    

      
</form> 
</div> 





<p>test</p></body>
</html>

 

thanks for looking...