1 | /* |
---|
2 | * To change this template, choose Tools | Templates |
---|
3 | * and open the template in the editor. |
---|
4 | */ |
---|
5 | package queryservice; |
---|
6 | |
---|
7 | import java.net.MalformedURLException; |
---|
8 | import java.net.URL; |
---|
9 | import java.security.KeyManagementException; |
---|
10 | import java.security.NoSuchAlgorithmException; |
---|
11 | import java.util.logging.Level; |
---|
12 | import java.util.logging.Logger; |
---|
13 | import javax.net.ssl.HttpsURLConnection; |
---|
14 | import javax.net.ssl.SSLContext; |
---|
15 | import javax.net.ssl.TrustManager; |
---|
16 | import javax.net.ssl.X509TrustManager; |
---|
17 | |
---|
18 | /** |
---|
19 | * |
---|
20 | * @author MartinH |
---|
21 | */ |
---|
22 | public class Main { |
---|
23 | |
---|
24 | static { |
---|
25 | // Create a trust manager that does not validate certificate chains |
---|
26 | TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() { |
---|
27 | |
---|
28 | public java.security.cert.X509Certificate[] getAcceptedIssuers() { |
---|
29 | return new java.security.cert.X509Certificate[]{}; |
---|
30 | } |
---|
31 | |
---|
32 | public void checkClientTrusted( |
---|
33 | java.security.cert.X509Certificate[] certs, String authType) { |
---|
34 | } |
---|
35 | |
---|
36 | public void checkServerTrusted( |
---|
37 | java.security.cert.X509Certificate[] certs, String authType) { |
---|
38 | } |
---|
39 | }}; |
---|
40 | |
---|
41 | SSLContext sc; |
---|
42 | try { |
---|
43 | sc = SSLContext.getInstance("SSL"); |
---|
44 | sc.init(null, trustAllCerts, new java.security.SecureRandom()); |
---|
45 | HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); |
---|
46 | } catch (NoSuchAlgorithmException e) { |
---|
47 | throw new RuntimeException(e); |
---|
48 | } catch (KeyManagementException e) { |
---|
49 | throw new RuntimeException(e); |
---|
50 | } |
---|
51 | |
---|
52 | } |
---|
53 | |
---|
54 | // public void GetFiltersTest() { |
---|
55 | // try { |
---|
56 | // QueryService srv = new QueryService(new URL("https://services.heuristiclab.com/OKB.SPR.Java-3.3/QueryService.svc?wsdl")); |
---|
57 | // IQueryService port = srv.getQueryService(); |
---|
58 | // |
---|
59 | // ArrayOfFilter filters = port.getFilters(); |
---|
60 | // for (Filter filter : filters.getFilter()) { |
---|
61 | // System.out.println("filter TypeName:=" + filter.getFilterTypeName().getValue()); |
---|
62 | // System.out.println("filter Label:=" + filter.getLabel().getValue()); |
---|
63 | // System.out.println("filter Class:=" + filter.getClass().getName()); |
---|
64 | // } |
---|
65 | // //assertTrue("No Filters found!", filters.getFilter().size() > 0); |
---|
66 | // //assertTrue("No Filters found!", filters.getFilter().size() > 0); |
---|
67 | // } catch (MalformedURLException ex) { |
---|
68 | // Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); |
---|
69 | // } |
---|
70 | // } |
---|
71 | |
---|
72 | /** |
---|
73 | * @param args the command line arguments |
---|
74 | */ |
---|
75 | public static void main(String[] args) { |
---|
76 | Main test = new Main(); |
---|
77 | // test.GetFiltersTest(); |
---|
78 | } |
---|
79 | } |
---|