Download Programming WebLogic Web Services
Transcript
Conf ig ur in g Sec ur it y
constructor specifies that the client application is using the WLSSSLAdapter subclass of the
SSLAdapter class.
To enable socket sharing in your client application with the API, use the
HttpsBindingInfo.setSocketSharing(boolean) setter method on the HttpsBindingInfo
object, passing it a value of true. To disable socket sharting, pass the method a value of false.
The default value, if you do not call this method in your application, is false (no socket sharing).
You can also specify the timeout value for shared sockets by using the
HttpsBindingInfo.setSharedSocketTimeout(long) method on the HttpsBindingInfo
object, passing it the number of seconds that shared sockets live. The default value, if you do not
set this method, is 15 seconds.
Note: This timeout value does nothing to the actual transport layer controlling the socket. The
value is used to determine if the SSL socket has not been referenced in the given
timeframe and if not, then on this reference, if the time has expired, then the socket is
closed and the protocol handshake is restarted.
To close the shared SSL socket in your client application, use the
HttpsBindingInfo.closeSharedSocket() method on the HttpsBindingInfo object. This
method takes no parameters. Typically you close the shared socket in the cleanup method of the
object from which you created the HttpsBindingInfo object.
Using a Third-Party SSL Implementation
If you want to use a third-party SSL implementation, you must first implement your own adapter
class. The following example shows a simple class that provides support for JSSE; the main steps
to implementing your own class are discussed after the example:
import
import
import
import
java.net.URL;
java.net.Socket;
java.net.URLConnection;
java.io.IOException;
public class JSSEAdapter implements weblogic.webservice.client.SSLAdapter {
javax.net.SocketFactory factory =
javax.net.ssl.SSLSocketFactory.getDefault();
// implements weblogic.webservice.client.SSLAdapter interface...
public Socket createSocket(String host, int port) throws IOException
return factory.createSocket(host, port);
}
13-38
Programming WebLogic Web Services
{
Related documents