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: 19,628
Registered: ‎07-14-2008
My Device: Not Specified

Re: Http connection not working from my j2me application.

Since you have coded ";deviceside=true", you are using direct TCP not BES/MDS. 

 

If you have found in my posts that I said ";deviceside=-true" means you are using BES/MDS, then please point me at the place and I will fix it.

 

To use BES/MDS you specify ";deviceside=false". 

 

So you can:

a) Assuming you are provisioned correctly, supply the APN parameters for your Vodafone carrier in the Options on your device

b) Change to using ";deviceside=false". 

 

If you device is a BES device, the  I recommend that you use (b). 

 

Most Vodafone carriers that I have come across, also support WAP - you will know this because there is a Vodafone Live WAP Browser on the device.  If you see this, then I think you will be able to use WAP on the device (but not in the Simulator, the Simulator does not support WAP). 

New Developer
Posts: 12
Registered: ‎03-06-2011
My Device: Not Specified

Re: Http connection not working from my j2me application.

Hi there,

 

I was having a very similar problem with my app, see post here:

 

http://supportforums.blackberry.com/t5/Java-Development/Problem-with-HttpConnection-when-not-connect...

 

I solved it using the connection suffix snippet of code compiled by mantaker here:

 

http://supportforums.blackberry.com/t5/Java-Development/Connecting-your-BlackBerry-http-and-socket-c...

 

Look specifically at the chunk of code that begins with:

 

 

String updateConnectionSuffix()

 

 

I know it sounds mental if you're knew to this and have developed on devices like iPhone which I had before. However, if you get the connection suffix right it should work fine.

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

Re: Http connection not working from my j2me application.

Note that the code supplied in updateConnectionSuffix() does not actually use BES connections.  If you have a BES device, you should use the BES (";deviceside=false") as the default connection suffix. 

Contributor
Posts: 10
Registered: ‎03-07-2011
My Device: 9700
My Carrier: Vodafone

Re: Http connection not working from my j2me application.

As i have already tried many things finally I tried the link that given by jacklenox . I got the from dose codes that its accessing all the available connection settings...but still getting nuts. I got this exception msg in BB9700. 

Error "Module not found" when I attempt to access a secure api.   :smileysad:

 

 

Contributor
Posts: 10
Registered: ‎03-07-2011
My Device: 9700
My Carrier: Vodafone

Re: Http connection not working from my j2me application.

[ Edited ]

I gone through that code of this. But didn't get the following code 

 

 

 

 

// Otherwise try the preferred connection type.
        if (con == null) {
            try {
                con = HttpUtils.makeHttpConnection( 
                            url, new HttpHeaders(), data, 
                            IOPreferences.getPreferredConnectionType());
                con.getResponseCode();
            } catch (Exception ex) {
                Log.error("UP.R1: " + ex);
                con = null;
            }
        }
IOPreferences.getPreferredConnectionType()); 

 

Could anyone please explain the above line. Actually its showing some error. 

If anyone have full code please email dat. My email id :- soumya_rout@live.com.

 

 

Contributor
Posts: 10
Registered: ‎03-07-2011
My Device: 9700
My Carrier: Vodafone

Re: Http connection not working from my j2me application.

Still this problem is not solved. Tried everything but no result. :Sleep1:

Is it true that Black Berry J2ME apps need to be signed with a key before i try any HTTPConnection from the application ? 

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

Re: Http connection not working from my j2me application.

Apologies, I have not noticed your updates to this Thread:

 

Error "Module not found" when I attempt to access a secure api

 

This indicates that you are using RIM specific API and you do need to sign it.  My understanding is that if you just use MIDlet (i.e. J2ME) code, you will not need to sign, so this indicates that you have code that is RIM specific.

Developer
Posts: 70
Registered: ‎11-24-2009
My Device: Not Specified

Re: Http connection not working from my j2me application.

As per my knowledge we dont need to sign the app while running on simualator.

Further these days I have seen that we dont need to run MDS for any network if using direct tcp.

This is true not only for 6.0 sims but also for 4.x sims like 8520 (latest sim) etc

Trusted Contributor
Posts: 103
Registered: ‎11-07-2010
My Device: Not Specified

Re: Http connection not working from my j2me application.

try to append the output of this metod on your URL without any other modifications to the url from you,

 

only URL+updateConnectionSuffix();

 

 

public static String updateConnectionSuffix() {
        String connSuffix = "";
        if (DeviceInfo.isSimulator()) {
            // connSuffix = ";deviceside=true";
            connSuffix = "";
        } else if ((WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED)
                && RadioInfo.areWAFsSupported(RadioInfo.WAF_WLAN)) {
            connSuffix = ";interface=wifi";
        } else {
            String uid = null;
            ServiceBook sb = ServiceBook.getSB();
            net.rim.device.api.servicebook.ServiceRecord[] records = sb
                    .findRecordsByCid("WPTCP");
            for (int i = 0; i < records.length; i++) {
                if (records[i].isValid() && !records[i].isDisabled()) {
                    if (records[i].getUid() != null
                            && records[i].getUid().length() != 0) {
                        if ((records[i].getCid().toLowerCase().indexOf("wptcp") != -1)
                                && (records[i].getUid().toLowerCase().indexOf(
                                        "wifi") == -1)
                                && (records[i].getUid().toLowerCase().indexOf(
                                        "mms") == -1)) {
                            uid = records[i].getUid();
                            break;
                        }
                    }
                }
            }
            if (uid != null) {
                // WAP2 Connection
                connSuffix += ";deviceside=true" + ";ConnectionUID=" + uid;
            }
        }
        return connSuffix;
    }

Contributor
Posts: 10
Registered: ‎03-07-2011
My Device: 9700
My Carrier: Vodafone

Re: Http connection not working from my j2me application.

I signed the application right now its working fine.... 

Finally i got rid of this problem .. 

Thanks a lot all for the help. Specially Peter