views:

49

answers:

1

Hi,

I've built a ASP.NET webservice and I'm trying to access it from a Blackberry. I've been testing it out with multiple devices and the simulator and it works fine, but there's just the one Blackberry 9000 (It's not the model, I've tried it out with another Blackberry 9000), and it's stuck waiting for a response from the server. Relevant section of the code that accesses this -

        System.out.println("IN ntwk access thread, start point");
        HttpConnection connection = (HttpConnection)Connector.open(serviceURL + WSNAME);
        connection.setRequestMethod(HttpConnection.POST);
        connection.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
        connection.setRequestProperty("Content-length", Integer.toString(postData1.length));
        OutputStream requestOutput = connection.openOutputStream();

        requestOutput.write(postData1);
        requestOutput.close();

        final int responseCode = connection.getResponseCode();
        if(responseCode!= HttpConnection.HTTP_OK) {
            //Process the error condition
        }
        // Request succeeded process the data.

It seems to be getting stuck after connection.getResponseCode(). Is there some way I can verify what's going wrong with this particular device?

Thanks,
Teja

A: 

So it turns out I wasn't handling the network right. It wasn't working in the device because I needed to explicitly mention which connection I wanted the device to use. Not doing this will make it work fine in the simulator, but not on the phone itself.

For now, I've appended ;deviceside=false to the connection string and this makes it use the carrier's data service without Blackberry's involvement.

Tejaswi Yerukalapudi