gpt4 book ai didi

java - 没有类型 {http ://schemas. xmlsoap.org/ws/2005/07/securitypolicy} 的断言构建器

转载 作者:行者123 更新时间:2023-11-30 02:35:13 24 4
gpt4 key购买 nike

我正在使用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.

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

注意:我添加了 SecurityUsernameToken,它在自定义 SOAPHandler 中具有用户名密码

谢谢:)

最佳答案

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

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

<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

关于java - 没有类型 {http ://schemas. xmlsoap.org/ws/2005/07/securitypolicy} 的断言构建器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43279615/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com