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

标签 java web-services wsdl websphere-liberty

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

相关文章:

java - 如何将 HashMap 作为 Java Web 服务的输入?

javascript - 如何简单地让 HTML 发送一个号码并接收一个号码?

Python Spyne - SOAP 服务器 - 不需要此元素。预期是({http ://} Element_name )

java - 我如何调整该程序以符合在线法官的要求?

java - 无法让 ManyToMany 处理 Hibernate Criteria 中的项目列表

java - 使用 Junit5 在 Spring Boot 应用程序中测试服务层时如何避免数据库连接

java - 执行 Web 服务时出现问题

javascript - 从 Web Angular 看 Notifications API 和 Push API 的区别

c# - 如何使用 async/await 调用网络服务?

java - 自定义组件的 JTree 自定义单元格编辑器不响应首次单击