{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy} 类型没有断言生成器

No assertion builder for type {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}

我正在使用 IBM Liberty 16.0.0.4

我正在尝试通过使用 wsimport 分类的生成的客户端调用 Web 服务,但是当我尝试调用端点服务时,我收到了下一个警告和错误。

[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.

你知道我是否需要添加额外的罐子或者我真正的问题是什么?或者缺少了什么?

注意:我添加了 SecurityUsernameToken,其中有 username自定义 SOAPHandler

中的密码

谢谢:)

我找到了在 Liberty 服务器上启用 wsSecurity 的解决方案,它需要显式启用。

所以我在里面使用了 wsSecurity-1.1 <featureManager>

<feature>wsSecurity-1.1</feature>

此外,为了发送用户名和密码的凭据,我需要使用下一个代码作为 UsernameToken

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

而且不仅仅是使用像这样的安全 SOAP 元素将 UsernameToken 添加到 header

security.addChildElement("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