他们说here在apache cxf中有3种方法可以构建一个rest客户端
我的问题是:
1)Iam遵循第一种方法 - 注射代理,我错过了什么?
2)如何使用apache cxf spring配置使用jax-rs webservice(安全签名证书)?
Webservice网址:
http://localhost:8080/services/userSvc/getUserInfo?param1=value1¶m2=value2"
UserInfoSvc.java:
// What code should be written here
application-context.xml:
<jaxrs:client id="restClient"
address="http://localhost:8080/services/userSvc/getUserInfo"
serviceClass="com.example.client.UserInfoSvc"
inheritHeaders="true">
<jaxrs:headers>
<entry key="Accept" value="text/json"/>
</jaxrs:headers>
答案 0 :(得分:0)
您可以使用http-conduit在application-context.xml
中为客户端指定证书<http:conduit name="*.http-conduit">
<http:tlsClientParameters>
<sec:keyManagers keyPassword="${ssl.keystorepassword}">
<sec:keyStore type="JKS" password="${ssl.keystorepassword}"
file="${ssl.keystorefile}" />
</sec:keyManagers>
<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:tlsClientParameters>
<http:authorization>
</http:authorization>
<http:client AutoRedirect="true" Connection="Keep-Alive" />
</http:conduit>
注意:在我的情况下,http管道应用于所有服务,因为我使用name="*.http-conduit"
您可以自定义用于sepcifc服务或代理以获取详细信息,请参阅{ {3}}
http和sec的命名空间是
xmlns:http="http://cxf.apache.org/transports/http/configuration"
xmlns:sec="http://cxf.apache.org/configuration/security"