Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/07/11 18:34:30 (14 years ago)
Author:
bfarka
Message:

restructure of service project #1218

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/OKBJavaConnector/HLOKBWebClient/src/main/java/at/hl/okb/wsclient/OKBServiceClient.java

    r5229 r5233  
    33import static at.hl.okb.wsclient.Utilities.createNameFilter;
    44
     5import java.security.KeyManagementException;
     6import java.security.NoSuchAlgorithmException;
    57import java.util.ArrayList;
    68import java.util.HashMap;
     
    810import java.util.Map;
    911
    10 import javax.xml.bind.JAXBElement;
    11 import javax.xml.namespace.QName;
    12 
    13 import com.google.common.collect.Iterables;
     12import javax.net.ssl.HttpsURLConnection;
     13import javax.net.ssl.SSLContext;
     14import javax.net.ssl.TrustManager;
     15import javax.net.ssl.X509TrustManager;
    1416
    1517import at.hl.wsclient.okb.Algorithm;
     
    1719import at.hl.wsclient.okb.ArrayOfAlgorithm;
    1820import at.hl.wsclient.okb.ArrayOfAlgorithmParameter;
    19 import at.hl.wsclient.okb.ArrayOfPlatform;
    2021import at.hl.wsclient.okb.ArrayOfProblem;
    2122import at.hl.wsclient.okb.IOKBService;
     
    2526import at.hl.wsclient.okb.Problem;
    2627
     28import com.google.common.collect.Iterables;
     29
    2730public class OKBServiceClient {
    2831    OKBService srv = null;
    2932    IOKBService port = null;
    3033
     34    // hack for allowing self signed certificates
     35    static {
     36  // Create a trust manager that does not validate certificate chains
     37  TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
     38      public java.security.cert.X509Certificate[] getAcceptedIssuers() {
     39    return new java.security.cert.X509Certificate[] {};
     40      }
     41
     42      public void checkClientTrusted(
     43        java.security.cert.X509Certificate[] certs, String authType) {
     44      }
     45
     46      public void checkServerTrusted(
     47        java.security.cert.X509Certificate[] certs, String authType) {
     48      }
     49  } };
     50
     51  SSLContext sc;
     52  try {
     53      sc = SSLContext.getInstance("SSL");
     54      sc.init(null, trustAllCerts, new java.security.SecureRandom());
     55      HttpsURLConnection
     56        .setDefaultSSLSocketFactory(sc.getSocketFactory());
     57  } catch (NoSuchAlgorithmException e) {
     58      throw new RuntimeException(e);
     59  } catch (KeyManagementException e) {
     60      throw new RuntimeException(e);
     61  }
     62
     63    }
     64
    3165    public OKBServiceClient() {
    3266  this.srv = new OKBService();
    33   this.port = srv.getWSHttpBindingIOKBService();
     67  this.port = srv.getWSHttpBindingIOKBService1();
    3468    }
    3569
     
    4882
    4983    private void createPlatform(String name) {
    50  
     84
    5185  ObjectFactory factory = new ObjectFactory();
    5286  Platform platform = factory.createPlatform();
    53  
     87
    5488  platform.setName(factory.createNamedOKBItemName(name));
    5589  port.addPlatform(platform);
Note: See TracChangeset for help on using the changeset viewer.