Gemalto is now part of the Thales Group, find out more.

You are here

HTTPConnection : Profile could not be activated | Thales IoT Developer Community

April 7, 2014 - 12:52am, 8503 views

I'm executing an HTTP POST with the code below and most of the time this is working fine. private static final String CONNECTOR_EXT=";;bearer_type=gprs"; private static final String URL_PREFIX=""; private void executePOST(String url, Vector headers) throws IOException { HttpConnection httpConn = null; InputStream is = null; OutputStream os = null; try { httpConn = (HttpConnection) + CONNECTOR_EXT); httpConn.setRequestMethod(HttpConnection.POST); os = httpConn.openOutputStream(); System.out.println("Response code = " + httpConn.getResponseCode()); System.out.println("Response msg = " + httpConn.getResponseMessage()); ...... On some occasions however, I'm getting the following error. (Usually the first timeI do a POST just after the board startup). Profile could not be activated -, bci=149 -, bci=4 -, bci=31 -, bci=41 -, bci=108 -, bci=7 -, bci=33 -, bci=3 -, bci=6 - com.ecs.hello.HelloWorld.downloadPage( - com.ecs.hello.HelloWorld.startApp( - javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1 - com.sun.midp.midlet.MIDletPeer.startApp(), bci=5 - com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=261 - com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=38 - com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=5 - com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=134 - com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26 Can this occur because the modem hasn't established a valid connection yet ? (waiting for a signal, connecting to the provider ?). I have a midlet that, upon startup, executes 3 POSTs with a 10 second interval and 95% of the time the first POST never occurs. I don't have logging at this point but I assume it is the error above. How should my code handle this scenario ? Is there a clean way for me check if connectivity is available before attempting to do a POST ?