axis2 over https starter question
I am trying to figure out how to use a开发者_JAVA技巧xis2 over https.
The axis2 guide says:CommonsHTTPTransportSender can be also used to communicate over https.
also:
Please note that by default HTTPS works only when the server does not expect to authenticate the clients (1-way SSL only) and where the server has the clients' public keys in its trust store. If you want to perform SSL client authentication (2-way SSL), you may use the Protocol.registerProtocol feature of HttpClient.
So my question is are there are 2 approaches for HTTPS for axis?
1) To use CommonsHTTPTransportSender 2) Uncomment the https connector on apache configuration ?? Or only (1) is the standard approach?? Also what is the problem with client authentication? I know that for apache connector I just need to set the clientAuth. This does not work for axis?Any input is welcome!
ThanksReference: http://axis.apache.org/axis2/java/core/docs/servlet-transport.html
For each protocol (HTTP and/or HTTPS), an AxisServletListener instance must be declared in axis2.xml. If only a single protocol is used, no further configuration is required. For example, if only HTTP is used, the following declaration must be present in axis2.xml:
<transportReceiver name="http" class="org.apache.axis2.transport.http.AxisServletListener"/>
If both HTTP and HTTPS are used, then things become a bit more complicated. The reason is that in order to expose WSDLs with correct endpoint URIs, AxisServlet must know the ports used by HTTP and HTTPS. Unfortunately the servlet API doesn't allow a Web application to discover all configured protocols. It only provides information about the protocol, host name and port for the current request. If only a single AxisServletListener is configured, then this information is enough to let AxisServlet auto-detect the port number. If both HTTP and HTTPS are used (or if WSDLs are retrieved through transports other than AxisServlet), then AxisServlet has no way of knowing the port numbers until it has processed at least one request for each protocol. To make WSDL generation predictable in this scenario, it is necessary to explicitly configure the port numbers in axis2.xml, such as in the following example:
<transportReceiver name="http" class="org.apache.axis2.transport.http.AxisServletListener">
<parameter name="port">8080</parameter>
</transportReceiver>
<transportReceiver name="https" class="org.apache.axis2.transport.http.AxisServletListener">
<parameter name="port">8443</parameter>
</transportReceiver>
Here's what I am using in my axis.xml configuration for the https connector approach (Axis 1.4.1).
<transportReceiver name="https" class="org.apache.axis2.transport.nhttp.HttpCoreNIOSSLListener">
<parameter name="port" locked="false">9002</parameter>
<parameter name="non-blocking" locked="false">true</parameter>
<parameter name="keystore" locked="false">
<KeyStore>
<Location>.keystore</Location>
<Type>JKS</Type>
<Password>changeme</Password>
<KeyPassword>changeme2</KeyPassword>
</KeyStore>
</parameter>
</transportReceiver>
I dumped my keystore under axis2-1.4.1/lib to avoid adding a dedicated classpath.
精彩评论