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