Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OKBJavaConnector/QueryService/src/queryservice/Main.java @ 11571

Last change on this file since 11571 was 6157, checked in by bfarka, 14 years ago

added ecj and custom statistics to communicate with the okb services #1441

File size: 2.7 KB
Line 
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5package queryservice;
6
7import java.net.MalformedURLException;
8import java.net.URL;
9import java.security.KeyManagementException;
10import java.security.NoSuchAlgorithmException;
11import java.util.logging.Level;
12import java.util.logging.Logger;
13import javax.net.ssl.HttpsURLConnection;
14import javax.net.ssl.SSLContext;
15import javax.net.ssl.TrustManager;
16import javax.net.ssl.X509TrustManager;
17
18/**
19 *
20 * @author MartinH
21 */
22public 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}
Note: See TracBrowser for help on using the repository browser.