0
嘗試從URL中讀取XML時,出現SSLHandshakeException。 錯誤發生在這一行: Document doc = db.parse(new InputSource(url.openStream()));嘗試從URL中讀取XML時發生ssl.SSLHandshakeException
protected LinearLayout doInBackground(String... string) {
LinearLayout layout = new LinearLayout(DevicesActivity.this);
layout.setOrientation(1);
/** Create a new textview array to display the results */
TextView device[];
try {
URL url = new URL();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new InputSource(url.openStream()));
doc.getDocumentElement().normalize();
登錄:
05-30 15:18:21.742: I/Choreographer(12300): Skipped 59 frames! The application may be doing too much work on its main thread.
05-30 15:18:22.305: I/ActivityManager(290): Displayed com.example.wip/.DevicesActivity: +2s340ms
05-30 15:18:23.992: I/System.out(12300): XML Pasing Excpetion = javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
而且我從Chrome的這條消息時,我嘗試看看URL
the identity of this website has not been verified.• server's certificate is not trusted
這是網站服務器的問題的頁面信息?我可以修理它在我身邊嗎?
謝謝。我怎樣才能做到這一點?我想試試看看我能否獲得XML。 – Michael
使用Keytool - http://docs.oracle.com/javase/6/docs/technotes/tools/windows/keytool.html –
如果你只想要的是XML,那麼使用Web瀏覽器下載它,告訴瀏覽器無論如何,請使用錯誤的證書。但請注意,服務器*還*需要用戶名和密碼。 –