/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package authservice; import com.heuristiclab.services.authentication.AuthenticationService; import com.heuristiclab.services.authentication.ArrayOfUser; import com.heuristiclab.services.authentication.User; import com.heuristiclab.services.authentication.IAuthenticationService; import java.net.MalformedURLException; import java.net.URL; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.util.logging.Level; import java.util.logging.Logger; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; /** * * @author MartinH */ public class Main { static { // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return new java.security.cert.X509Certificate[]{}; } public void checkClientTrusted( java.security.cert.X509Certificate[] certs, String authType) { } public void checkServerTrusted( java.security.cert.X509Certificate[] certs, String authType) { } }}; SSLContext sc; try { sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } catch (KeyManagementException e) { throw new RuntimeException(e); } } public void GetUsersTest() { // try { //AuthenticationService srv = new AuthenticationService(new URL("https://services.heuristiclab.com/OKB.SPR.Java-3.3/AuthenticationService.svc?wsdl")); AuthenticationService srv = new AuthenticationService(); IAuthenticationService port = srv.getAuthenticationService(); ArrayOfUser users = port.getUsers(); for (User user : users.getUser()) { System.out.println("user Name:=" + user.getName().getValue()); System.out.println("user Class:=" + user.getClass().getName()); } //} catch (MalformedURLException ex) { // Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); //} } /** * @param args the command line arguments */ public static void main(String[] args) { Main test = new Main(); test.GetUsersTest(); } }