Hi all
We use Apache Soap 2.2 in our products for pushing log files over the web
to a central log server. This is done via Apache Soap. In order to make
this secure enough, we are using client certs for the SOAP client. To do
this, I made a small patch to the SSLUtils class enabling setting a custom
socket factory. I'm happy to contibute the patch if it will fit in the
SOAP project.
/Johan Hedin
Please Cc comments directly to me, since I'm not on the list.
--- src/org/apache/soap/util/net/SSLUtils.java.orgi Mon Apr 15 11:00:10 2002
+++ src/org/apache/soap/util/net/SSLUtils.java Mon Apr 15 11:03:54 2002
@@ -69,15 +69,23 @@
* @author Chris Nelson ([EMAIL PROTECTED])
*/
public class SSLUtils {
+
+ private static SSLSocketFactory sf =
+(SSLSocketFactory)SSLSocketFactory.getDefault();
+
+ /** Set the SSL socket factory
+ * @param sf The SSLSocketFactory
+ */
+ public static void setSSLSocketFactory(SSLSocketFactory sf) {
+ SSLUtils.sf = sf;
+ }
+
/** This method builds an SSL socket, after auto-starting SSL */
public static Socket buildSSLSocket(String host, int port)
throws IOException, UnknownHostException
{
- SSLSocketFactory factory =
- (SSLSocketFactory)SSLSocketFactory.getDefault();
SSLSocket sslSocket =
- (SSLSocket)factory.createSocket(host, port);
+ (SSLSocket)sf.createSocket(host, port);
/*
* Handshaking is started manually in this example because