자체 서명 인증서가있는 호스팅을 사용합니다. 따라서 내 도메인 https://www.marpel.cz/에서 인증서를 다운로드하고 http://portecle.sourceforge.net/을 사용하여 .bks 파일을 만들었습니다.자체 서명 인증서
https 연결을 설정하고 웹 서비스에서 데이터를 검색해야합니다. 나는 ksoap2 라이브러리를 사용한다. 나는 ksoap2 위키에 명시된 클래스 ConnectionWithSelfSignedCertificate을 복사하여 사용했습니다.
이
내가 키 스토어MainActivity.java
// Get an instance of the Bouncy Castle KeyStore format
try {
this.keyStore = KeyStore.getInstance("BKS");
} catch (KeyStoreException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// Get the raw resource, which contains the keystore with
// your trusted certificates (root and any intermediate certs)
InputStream in = this.getApplicationContext().getResources().openRawResource(R.raw.myCer);
try {
// Initialize the keystore with the provided trusted certificates
// Also provide the password of the keystore
this.keyStore.load(in, "myPass".toCharArray());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
try {
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try {
this.sslSocketFactory = new ConnectionWithSelfSignedCertificate(this.keyStore).getSSLSocketFactory();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
를 만드는 방법입니다 그리고 이것은 AsyncTask를
background task
final HttpsTransportSE transportSE = new HttpsTransportSE(URL, PORT, SERVICE, TIMEOUT);
try {
((HttpsServiceConnectionSE) transportSE.getServiceConnection()).setSSLSocketFactory(this.sslSocketFactory);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
내가 transportSE.call (SOAP_ACTION, 봉투)를 호출하는 경우에서 코드; IOException이 발생하고 호스트 이름 'www.marpel.cz'이 확인되지 않았습니다. 내가 뭘 잘못 했니?
ICS 4.1.2 장치가 있습니다.