2010-05-11 84 views
0

我已經構建了一個ASP.NET web服務,我試圖從黑莓訪問它。我一直在使用多種設備和模擬器對它進行測試,並且工作正常,但只有一款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()後卡住了。有什麼方法可以驗證此特定設備出了什麼問題?

感謝,
Teja公司

回答

0

因此,原來我沒有處理網絡的權利。它不在設備中工作,因爲我需要明確提及我希望設備使用哪個連接。不這樣做會使它在模擬器中正常工作,但不在電話本身。

現在,我在連接字符串中添加了deviceside = false,這使得它在沒有Blackberry參與的情況下使用運營商的數據服務。

相關問題