简体   繁体   English

通过https启动器问题的axis2

[英]axis2 over https starter question

I am trying to figure out how to use axis2 over https. 我试图弄清楚如何通过https使用axis2。
The axis2 guide says: axis2指南说:

CommonsHTTPTransportSender can be also used to communicate over https. CommonsHTTPTransportSender也可以用于通过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. 请注意,默认情况下,仅当服务器不希望对客户端进行身份验证时(仅1路SSL),并且服务器在其信任库中具有客户端的公共密钥时,HTTPS才起作用。 If you want to perform SSL client authentication (2-way SSL), you may use the Protocol.registerProtocol feature of HttpClient. 如果要执行SSL客户端身份验证(2-way SSL),则可以使用HttpClient的Protocol.registerProtocol功能。

So my question is are there are 2 approaches for HTTPS for axis? 所以我的问题是轴有HTTPS的两种方法吗?
1) To use CommonsHTTPTransportSender 1)使用CommonsHTTPTransportSender
2) Uncomment the https connector on apache configuration ?? 2)取消注释Apache连接器上的https连接器?
Or only (1) is the standard approach?? 还是只有(1)是标准方法?
Also what is the problem with client authentication? 客户端身份验证还有什么问题? I know that for apache connector I just need to set the clientAuth. 我知道对于apache连接器,我只需要设置clientAuth。 This does not work for axis? 这不适用于轴吗?

Any input is welcome! 欢迎任何输入!
Thanks 谢谢

Reference: http://axis.apache.org/axis2/java/core/docs/servlet-transport.html 参考: 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. 对于每种协议(HTTP和/或HTTPS),必须在axis2.xml中声明AxisServletListener实例。 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: 例如,如果仅使用HTTP,则在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. 如果同时使用HTTP和HTTPS,则事情将变得更加复杂。 The reason is that in order to expose WSDLs with correct endpoint URIs, AxisServlet must know the ports used by HTTP and HTTPS. 原因是,为了使用正确的端点URI公开WSDL,AxisServlet必须知道HTTP和HTTPS使用的端口。 Unfortunately the servlet API doesn't allow a Web application to discover all configured protocols. 不幸的是,servlet API不允许Web应用程序发现所有已配置的协议。 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. 如果仅配置了一个AxisServletListener,则此信息足以使AxisServlet自动检测端口号。 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. 如果同时使用HTTP和HTTPS(或者通过AxisServlet以外的其他传输方式检索WSDL),则AxisServlet无法处理端口号,直到为每个协议处理了至少一个请求。 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: 为了使这种情况下的WSDL生成可预测,必须在axis2.xml中显式配置端口号,例如以下示例:

<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). 这是我在axis.xml配置中用于https连接器方法(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. 我将密钥库转储在axis2-1.4.1 / lib下,以避免添加专用的类路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM