黑莓应用程序在尝试访问服务器时卡住

发布于 2024-09-01 03:20:11 字数 1050 浏览 5 评论 0原文

我已经构建了一个 ASP.NET Web 服务,并且正在尝试从 Blackberry 访问它。我已经用多个设备和模拟器对其进行了测试,它工作正常,但只有一台 Blackberry 9000(这不是型号,我已经用另一台 Blackberry 9000 进行了测试),并且它卡住了,等待响应从服务器。访问此代码的相关部分 -

        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.

connection.getResponseCode() 之后似乎陷入困境。有什么方法可以验证这个特定设备出了什么问题吗?

谢谢,
泰贾

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只怪假的太真实 2024-09-08 03:20:11

事实证明我没有正确处理网络。它在设备中不起作用,因为我需要明确提及我希望设备使用哪个连接。不这样做将使其在模拟器中正常工作,但不能在手机本身上正常工作。

目前,我已将 ;deviceside=false 附加到连接字符串中,这使其可以使用运营商的数据服务,而无需黑莓的参与。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文