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
Developer
Posts: 35
Registered: ‎10-11-2008
My Device: Not Specified
Accepted Solution

Web Services Connection ask for authorization

I have developed an application for my 8300 with software v 4.5

 

It consumes web services as client.

 

Each time the application tries to consume the web service a new screen shows asking user authorization to connect to the destination IP address.

 

How can I avoid this authorization request so my application runs without interruptions ?

 

Thank you

 

Antonio

 

Developer
Posts: 62
Registered: ‎07-14-2008
My Device: Not Specified

Re: Web Services Connection ask for authorization

You could use basic authentication (if your web server supports it) by adding the corresponding property to your http request. You should use SSL/TLS connection (HTTPS) in that case.

 

 

String login = "user" + ":" + "password";

String login_encoded = Base64OutputStream.encodeAsString(login.getBytes(),0,login.length(),false,false);
 

connection.setRequestProperty("Authorization", "Basic " + login_encoded);

 

 

 

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

Re: Web Services Connection ask for authorization

Alternatively, this could be the standard BlackBerry "Firewall/Permissions" Connection Checking screen.

 

Does it have an 'ask once' check box at the bottom of the dialog asking the question?  Try checking that.

 

If it is the Application Permissions, then you have a range of options including:

a) Have the user respond and use the 'ask once' option

b) Use the 'Set Permissions' option at download time when installing Over The Air

c) Set the Applications Permissions via the BES for this application (assuming you are pushing it from the BES)

d) Set the Permissions on the device - Options-->Advanced-->Applications-->Edit Permissions

e) Programatically in your Application

 

Look round here this forum for other users that have asked similar questions.

Developer
Posts: 35
Registered: ‎10-11-2008
My Device: Not Specified

Re: Web Services Connection ask for authorization

Thank you Ivanov for your answer.

 

I understand the request for permission to connect is done by the O.S.

The web service client within the Phone uses javax.microedition.xml.rpc.Operation, so I don´t know If I can control the attributes for the Http conection stablished by the Operation methos.

 

I will experiment and come back to you

 

Thank you

 

Antonio

 

 

Developer
Posts: 35
Registered: ‎10-11-2008
My Device: Not Specified

Re: Web Services Connection ask for authorization

Thank you Peter_strange for your answer.

 

I did change the permissions in the O.S. as you recommend.

After setting the permissions, the first time I launch the application it asks for permission.

When I close my application the close menu ask to "save or discard".  If I select "save", the next time I use my application it does not ask for authorization for Http connection.  I will review the BlackBerry docs to better understand this behaviour.

 

Antonio

Developer
Posts: 35
Registered: ‎10-11-2008
My Device: Not Specified

Re: Web Services Connection ask for authorization

Dear Peter_Strange

 

Additionally, The BlackBerry JDE 4.5 Development Guide states on page 228 that the HTTP connection should be put on a separate thread from the main thread.

 

Regards

 

Antonio

 

Developer
Posts: 141
Registered: ‎08-06-2008
My Device: Not Specified

Re: Web Services Connection ask for authorization

 
Highlighted
Developer
Posts: 141
Registered: ‎08-06-2008
My Device: Not Specified

Re: Web Services Connection ask for authorization

Hi Peter,

 

Do we have to use BES for Web Service?

 

Thanks.