- Timestamp:
- 01/07/11 18:34:30 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKBJavaConnector/HLOKBWebClient/src/main/java/at/hl/okb/wsclient/OKBServiceClient.java
r5229 r5233 3 3 import static at.hl.okb.wsclient.Utilities.createNameFilter; 4 4 5 import java.security.KeyManagementException; 6 import java.security.NoSuchAlgorithmException; 5 7 import java.util.ArrayList; 6 8 import java.util.HashMap; … … 8 10 import java.util.Map; 9 11 10 import javax. xml.bind.JAXBElement;11 import javax. xml.namespace.QName;12 13 import com.google.common.collect.Iterables;12 import javax.net.ssl.HttpsURLConnection; 13 import javax.net.ssl.SSLContext; 14 import javax.net.ssl.TrustManager; 15 import javax.net.ssl.X509TrustManager; 14 16 15 17 import at.hl.wsclient.okb.Algorithm; … … 17 19 import at.hl.wsclient.okb.ArrayOfAlgorithm; 18 20 import at.hl.wsclient.okb.ArrayOfAlgorithmParameter; 19 import at.hl.wsclient.okb.ArrayOfPlatform;20 21 import at.hl.wsclient.okb.ArrayOfProblem; 21 22 import at.hl.wsclient.okb.IOKBService; … … 25 26 import at.hl.wsclient.okb.Problem; 26 27 28 import com.google.common.collect.Iterables; 29 27 30 public class OKBServiceClient { 28 31 OKBService srv = null; 29 32 IOKBService port = null; 30 33 34 // hack for allowing self signed certificates 35 static { 36 // Create a trust manager that does not validate certificate chains 37 TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { 38 public java.security.cert.X509Certificate[] getAcceptedIssuers() { 39 return new java.security.cert.X509Certificate[] {}; 40 } 41 42 public void checkClientTrusted( 43 java.security.cert.X509Certificate[] certs, String authType) { 44 } 45 46 public void checkServerTrusted( 47 java.security.cert.X509Certificate[] certs, String authType) { 48 } 49 } }; 50 51 SSLContext sc; 52 try { 53 sc = SSLContext.getInstance("SSL"); 54 sc.init(null, trustAllCerts, new java.security.SecureRandom()); 55 HttpsURLConnection 56 .setDefaultSSLSocketFactory(sc.getSocketFactory()); 57 } catch (NoSuchAlgorithmException e) { 58 throw new RuntimeException(e); 59 } catch (KeyManagementException e) { 60 throw new RuntimeException(e); 61 } 62 63 } 64 31 65 public OKBServiceClient() { 32 66 this.srv = new OKBService(); 33 this.port = srv.getWSHttpBindingIOKBService ();67 this.port = srv.getWSHttpBindingIOKBService1(); 34 68 } 35 69 … … 48 82 49 83 private void createPlatform(String name) { 50 84 51 85 ObjectFactory factory = new ObjectFactory(); 52 86 Platform platform = factory.createPlatform(); 53 87 54 88 platform.setName(factory.createNamedOKBItemName(name)); 55 89 port.addPlatform(platform);
Note: See TracChangeset
for help on using the changeset viewer.