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