Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To write production ready code, the following things will need to be done.1) User

  •  User Story to implement One way SSL communication needed to make Https calls.

      ...

        • Currently the project is not set up to make HTTPS calls. For the POC the following code was added to workaround this issue.
      Code Block
      languagejava
      themeEclipse
      firstline1
      titleWorkaround Code for making HTTPS calls
      linenumberstrue
      collapsetrue
              final TrustManager[] trustAllCerts = new TrustManager[] {
      		  new X509TrustManager() {
                  public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                      return new ArrayList<X509Certificate>().toArray(new X509Certificate[0]);
                  }
      
                  public void checkClientTrusted(final X509Certificate[] certs, final String authType) {
                  }
      
                  public void checkServerTrusted(final X509Certificate[] certs, final String authType) {
                  }
                }
              };
      
              final SSLContext sc = SSLContext.getInstance("SSL");
              sc.init(null, trustAllCerts, new java.security.SecureRandom());
              HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
      
              final HostnameVerifier allHostsValid = new HostnameVerifier() {
                  public boolean verify(final String hostname, final SSLSession session) {
                      return true;
                  }
              };

      ...

      • User story to implement retrieving of the current list of xNF functions 
        • Part of the PoC code which does can be seen below
      Code Block
      languagejava
      themeEclipse
      firstline1
      titleCode to retrieve xNF functions from A&AI
      linenumberstrue
      collapsetrue
      		String nfData = "";
              final String aaiNetworkEndPoint = getAaiServiceUrlHttps();
              final URL url;
              try {
                  url = new URL(aaiNetworkEndPoint);
                  final HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
                  conn.setRequestProperty("Authorization", "Basic QUFJOkFBSQ==");
                  conn.setRequestProperty("accept", "application/json");
                  conn.setRequestProperty("conntent-type", "application/json");
                  conn.setRequestProperty("x-fromappid", "cps-ncmp");
                  conn.setRequestProperty("X-TransactionId", "get_aai_subscr");
                  conn.connect();
                  nfData = responseReader(conn);
      
              } catch (final IOException e) {
                  e.printStackTrace();
              }