0 Replies Latest reply on May 22, 2007 2:57 PM by Alfred Thomas

    Connecting to Secured WebService

    Alfred Thomas Newbie

      Hi

      I have a piece of code that connects to secured web service using certificates. The problem is that when I use it within an application in JBoss it doesn't work anymore. Do I have to add the certificates in a different way? My code is as follows:

      System.setProperty("javax.net.debug","all");
      System.setProperty("java.security.debug","all");
      System.setProperty("javax.net.ssl.keyStore", keystoreFilePath);
      System.setProperty("javax.net.ssl.keyStorePassword", "xxx");
      System.setProperty("javax.net.ssl.keyStoreType", "JKS");
      System.setProperty("javax.net.ssl.trustStore", truststoreFilePath);
      System.setProperty("javax.net.ssl.trustStorePassword", "xxx");
      System.setProperty("javax.net.ssl.trustStoreType", "JKS");
      System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
      Security.addProvider( new com.sun.net.ssl.internal.ssl.Provider() );

      SOAPConnection soapConnection = SOAPConnectionFactory.newInstance().createConnection();
      SOAPMessage responseMessage = soapConnection.call(requestMessage, url);


      Regards
      Alfred