3

I have a customer SecureSocketFactory set to be used by Axis when making an https connection using the following property:

AxisProperties.setProperty("axis.socketSecureFactory",
    "com.metavante.csp.model.manager.mobilepayments.MonitiseSSLSocketFactory");

When this class is instantiated by Axis, the constructor with a Hashtable (attributes) is called. I see the timeout attribute is set in this table. Is there anyway to set more values in this? I would like to be able to configure the Socket Factory on a per-instance scenario instead of globally by using static or system properties.

Edit: I found out these attributes are actually the HttpSender (BasicHandler) options. I still am unable to set these dynamically though.

tshepang
  • 12,111
  • 21
  • 91
  • 136
Adam
  • 277
  • 7
  • 17

2 Answers2

2

I figured out a way around the problem. In my code where I wanted to set the property I use: serviceLocator.getEngine().setOption(USE_CERT_PROPERTY, new Boolean(true));

where getEngine returns the AxisEngine in use. Then in the socket factory I can:

Boolean useSMS = (Boolean) MessageContext.getCurrentContext().getProperty(OtherClass.USE_CERT_PROPERTY);

I could set the object to whatever, maybe I'll go with the certificate name I needed. Hope this helps someone.

Adam
  • 277
  • 7
  • 17
1

You can retrieve the SocketFactory instance and then change or add attributes, if you are interested in modify SocketFactory behavior. But if you do this, you also should inject the HashTable attribute (with the timeout). I think there is not a final and pretty solution.

AxisProperties.setProperty("org.apache.axis.components.net.SecureSocketFactory", MyAxisSocketFactory.class.getName());
MyAxisSocketFactory factory = (MyAxisSocketFactory) SocketFactoryFactory.getFactory("https", myHashTableParams);
factory.setMyStuff();

After this code, the instance of SocketFactory will be created and configured, and ready to use in web services, or whatever ^_^

Luis
  • 61
  • 4