code: public static String getTargetNameSpace(String target) throws IOException {
          String version = "";
          String urlStr = "https://" + target + "/sdk/vimService?wsdl";
  
          try {
              trustAllHttpsCertificates();
          }
          catch (Exception e) {
              throw new RuntimeException(e);
          }
  
          HttpsURLConnection.setDefaultHostnameVerifier(
              new HostnameVerifier() {
                  public boolean verify(String urlHostName, SSLSession session) {
                      return true;
                  }
              });
  
          URL url = new URL(urlStr);
          HttpURLConnection conn = (HttpURLConnection) url.openConnection();
          conn.connect();
          BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
  
          String xmlWSDL = "";
          String line;
          while ((line = in.readLine()) != null) {
              xmlWSDL = xmlWSDL + line;
          }
  
          int start = xmlWSDL.indexOf("targetNamespace") + "targetNamespace".length();
          start = xmlWSDL.indexOf("\"", start);
          int end = xmlWSDL.indexOf("\"", start + 1);
          version = xmlWSDL.substring(start + 1, end);
  
          return version;
      }
docs: Retrieve the target server's name space
  
  @param target either IP or host name
  @return the namespace, e.g. urn:vim25Service
  @throws IOException      when there is a network issue or service issue on the target server
  @throws RuntimeException wrapping NoSuchAlgorithmException, KeyManagementException which are
  not likely to happen. If it happens, you can catch the runtime exception and unwrap it
  for the real exceptions.