2017-04-07 39 views
1

我使用IBM自由16.0.0.4沒有斷言建設者型{} http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

我想通過生成的客戶端調用Web服務使用wsimport歸類,但是當我嘗試調用端點服務時,我得到了下一個WARNING和ERROR。

[WARNING ] No assertion builder for type {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}TransportBinding registered. 
[WARNING ] No assertion builder for type {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}TransportToken registered. 
[WARNING ] No assertion builder for type {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}HttpsToken registered. 
[WARNING ] No assertion builder for type {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}AlgorithmSuite registered. 
[WARNING ] No assertion builder for type {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}Basic256 registered. 
[WARNING ] No assertion builder for type {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}Layout registered. 
[WARNING ] No assertion builder for type {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}Lax registered. 
[WARNING ] No assertion builder for type {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}IncludeTimestamp registered. 
[WARNING ] No assertion builder for type {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}SignedSupportingTokens registered. 
[WARNING ] No assertion builder for type {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}UsernameToken registered. 
[ERROR ] None of the policy alternatives can be satisfied. 
None of the policy alternatives can be satisfied. 

你知道我是否需要添加額外的罐子或什麼是我的真正問題?或缺少什麼?

注:我添加安全的UsernameToken其中有用戶名密碼定製SOAPHandler

謝謝:)

回答

2

我發現了一個解決方案上啓用的WSSecurity在自由服務器,它需要顯式啓用。

所以我用的WSSecurity-1.1裏面<featureManager>

<feature>wsSecurity-1.1</feature> 

還可以用來傳送用戶名和密碼的憑據,我是需要使用下面的代碼爲用戶名令牌

Map ctx = ((BindingProvider) port).getRequestContext(); 
ctx.put("ws-security.username", "username"); 
ctx.put("ws-security.password", "password"); 

而且不只是添加用戶名令牌爲標題使用這樣的安全SOAP元素

security.addChildElemen t(「UsernameToken」,「wsse」);

參考

1- https://www.ibm.com/support/knowledgecenter/was_beta/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/cwlp_wssec_msglvl.html

2- https://www.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/cwlp_wssec_cxf_diff.html