为什么 axis2 客户端在使用 HTTPS 时提示"An unknown transport called https exists."?



在HTTP中使用axis客户机时,我的代码工作得很好,但是一旦使用HTTPS端点,就会得到以下堆栈跟踪

Caused by: org.apache.axis2.AxisFault: An unknown transport called https exists.
at org.apache.axis2.description.ClientUtils.inferInTransport(ClientUtils.java:119) ~[axis2-kernel.jar:1.5.4]
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:183) ~[axis2-kernel.jar:1.5.4]
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) ~[axis2-kernel.jar:1.5.4]
at com.vodafone.gdsp.ws.SubmitSMSv2ServiceStub.submitSMSv2(SubmitSMSv2ServiceStub.java:193) ~[vodafonews.jar:?]
at com.trilliantnetworks.vodafone.services.CallVodafoneServices.submitSMSv2(CallVodafoneServices.java:447) ~[vodafonews.jar:?]
... 21 more

下面是HTTP客户端配置

HttpClientParams httpClientParams = new HttpClientParams();
httpClientParams.setConnectionManagerTimeout(10000L);
HttpClient client = new HttpClient(httpClientParams, conMgr);
context.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, client);
context.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
context.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION, Boolean.TRUE);

这是我在调用之前使用的代码

// Enabling auto cleanup & activating asynchronous connection handler
serviceStub._getServiceClient().getOptions().setCallTransportCleanup(true);
serviceStub._getServiceClient().getOptions().setUseSeparateListener(true);
serviceStub._getServiceClient().engageModule("addressing");
// Executing a cleanup of the connection before using it in case.
serviceStub._getServiceClient().cleanup();
serviceStub._getServiceClient().cleanupTransport();

关于这个没有太多的文档,有人看到我在这里做错了吗?

默认情况下,axis2配置中没有HTTPS描述符。您通常可以通过代码更改它,但由于某种原因,我的版本不起作用。您可以做的是复制位于您的maven存储库中的JAR中的axis2的普通版本,您可以使用7zip打开该版本。然后在您的代码中,当创建上下文时,指定配置文件的路径:

ConfigurationContext context = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, "C:\Path\To\Your\Custom\axis2.xml");

在您的配置中将Transport Outs部分替换为以下

<transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender" />
<transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
<parameter name="PROTOCOL">HTTP/1.1</parameter>
<parameter name="Transfer-Encoding">chunked</parameter>
<!-- If following is set to 'true', optional action part of the 
Content-Type will not be added to the SOAP 1.2 messages -->
<!--  <parameter name="OmitSOAP12Action">true</parameter>  -->
</transportSender>
<transportSender name="https" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
<parameter name="PROTOCOL">HTTP/1.1</parameter>
<parameter name="Transfer-Encoding">chunked</parameter>
<!-- If following is set to 'true', optional action part of the 
Content-Type will not be added to the SOAP 1.2 messages -->
<!--  <parameter name="OmitSOAP12Action">true</parameter>  -->
</transportSender>
<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>

你可以在SAP网站上找到

一旦配置就绪,axis2应该能够找到HTTPS描述符,错误就会消失。

下面是我使用的完整配置,我使用的是axis2版本1.5.4

Axis2在多线程模式下支持HTTPS的完整配置

相关内容

  • 没有找到相关文章

最新更新