我试图了解如何使用Java注释而不是spring.xml配置http cxf管道。
这是我要转换为Java bean的xml。
<http-conf:conduit name="*.http-conduit">
<http-conf:client ConnectionTimeout="${http.connection.timeout:300000}"
ReceiveTimeout="${http.read.timeout:300000}"/>
<http-conf:tlsClientParameters
disableCNCheck="${transport.tslClientParameters.disableCNCheck}">
<sec:trustManagers>
<sec:keyStore type="${transport.tslClientParameters.storeType}"
resource="${transport.tslClientParameters.trustStore}"
password="${transport.tslClientParameters.trustStorePassword}"/>
</sec:trustManagers>
<sec:cipherSuitesFilter>
<sec:include>.*_EXPORT_.*</sec:include>
<sec:include>.*_EXPORT1024_.*</sec:include>
<sec:include>.*_WITH_DES_.*</sec:include>
<sec:include>.*_WITH_AES_.*</sec:include>
<sec:include>.*_WITH_NULL_.*</sec:include>
<sec:exclude>.*_DH_anon_.*</sec:exclude>
</sec:cipherSuitesFilter>
</http-conf:tlsClientParameters>
</http-conf:conduit>
到目前为止,我已经尝试查看Apache CXF Documentation中的文档,但是仍然没有太多线索。
答案 0 :(得分:0)
我知道这是一篇过时的文章,但是由于我遇到了同样的问题,这就是我所做的:
public <T> T createSoapClient(Class<T> serviceClass, URL endpoint, String namespace)
{
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
Bus bus = new ExtensionManagerBus(null, null, Bus.class.getClassLoader());
factory.setBus(bus);
factory.setServiceClass(serviceClass);
factory.setServiceName(new QName(namespace, serviceClass.getSimpleName()));
factory.setAddress(endpoint.toString());
factory.getServiceFactory().getServiceConfigurations().add(0, new XFireCompatabilityConfiguration());
factory.setDataBinding(new AegisDatabinding());
@SuppressWarnings("unchecked")
T soapClient = (T) factory.create();
Client client = ClientProxy.getClient(soapClient);
client.getRequestContext().put(Message.MAINTAIN_SESSION, true);
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setReceiveTimeout(600000);
policy.setAllowChunking(false);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
conduit.setClient(policy);
return soapClient;
}
感谢:https://www.programcreek.com/java-api-examples/?api=org.apache.cxf.transport.http.HTTPConduit