English

Error: java.net.MalformedURLException: unknown protocol: https

Error Message

An error message may occur while making a request to an ArcWeb Service by one of these methods:

1. Using the WSDL2Java command with Axis Web service toolkit to point to a URL of a WSDL on an https server.

For example:

Code:
java org.apache.axis.wsdl.WSDL2Java
https://arcweb.esri.com/services/v2006_1/AddressFinder?wsdl


2. Creating stubs using an http URL and then binding those stubs to an https URL.

For example:

Code:
URL url = new URL("https://arcweb.esri.com/services/v1/Authentication");
Authentication auth = new AuthenticationLocator();
IAuthentication iauth = auth.getIAuthentication(url);


The error message reads:

Code:
java.net.MalformedURLException: unknown protocol: https

Cause

You are using a version of the Java Developer Kit (JDK) that was released prior to JDK 1.4.

Solution or Workaround

  1. Open the master security properties file found at
    %JAVA_HOME%\jre\lib\security\java.security

  2. Add the following line of code to the java.security file:
    Code:
    security.provider.N=com.sun.net.ssl.internal.www.protocol

    where 'N' is an integer larger than the numbers already in this file.
  3. Download and install JSSE from the Sun Web site.
    This download contains the following three files: jnet.jar, jsse.jar, and jcert.jar.
  4. Add the three files to your CLASSPATH.
  5. Only perform the following if you originally received the error by running the WSDL2Java command.
    Run the following command at a command prompt to generate https stubs:

    Code:
    Java -D java.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol org.apache.axis.wsdl.WSDL2Java
    https://arcweb.esri.com/services/v2006_1/AddressFinder?wsdl -p esri.aws.v2006_1.axisstubs -v

  6. If you wish to execute a JSP application, copy jnet.jar, jsse.jar and jcert.jar to %JAVA_HOME%\jre\lib\ext directory.

    Note: Before binding the URL of the WSDL in the JSP code, these lines should be included:

    Code:
    System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
    Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

    These two lines of code (in Step 6) allow the Web server to support HTTPS. Execute this method once; it will remain in use for the application until the Web server is restarted.

Related Information