I will go a little into details.

I am building a simple app to send data to a web server through WAP.

Data is entered in a form and the user select the submit button having the following
codes in commandAction() part:

public void commandAction(Command c, Displayable s) {
if (c == cmdSubmit) {
Thread t = new Thread(this);

In the run() method the following codes are present:

public void run() {
Display display = Display.getDisplay(this);

String pData = "";

String word = "ebook";

try {
pData = lookUp(word);
catch (IOException ioe) {
Alert report = new Alert("Sorry", "Could not retrieve information", null, null);

And finally in the lookUp() method, there are the following codes:

private String lookUp(String word) throws IOException {
HttpConnection hc = null;
InputStream in = null;
String definition = null;

try {
String baseURL = "";

String url = baseURL + word;
hc = (HttpConnection)Connector.open(url);
hc.setRequestProperty("Connection", "close");
in = hc.openInputStream();
int contentLength = (int)hc.getLength();
if (contentLength == -1) contentLength = 255;
byte[] raw = new byte[contentLength];
int length = in.read(raw);

// Clean up.
definition = new String(raw, 0, length);

finally {
try {
if (in != null) in.close();
if (hc != null) hc.close();

catch (IOException ignored) {}

return definition;

When I run the app and I select the submit button, I am asked if I want to send
the info to the URL using airtime and that this will result in charges. Then the options
'Yes' and 'No' are given.

If I select 'Yes', things works fine.

However, if I select 'No', the app send me back to the form and when I select the submit
button again, nothing happen and the following message is displayed in the toolkit window:

Uncaught exception java/lang/SecurityException: Application not authorized to access the restricted API.

I can't figure out why I am having this error.

I would be grateful if anyone can help me out with this. Thanks.