Search code examples
javaweb-serviceswsdlwebsphere-liberty

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


I am using IBM Liberty 16.0.0.4

I am trying to call webservice through generated client classed using wsimport, but when i try to call endpoint service i got next WARNINGs and 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.

Do you know if i need to add extra jars or what is my real problem? or what is missing?

Note: i added Security with UsernameToken which have the username and password in custom SOAPHandler

Thanks :)


Solution

  • I found a solution on enabling wsSecurity on Liberty server and it needs to be enabled explicitly.

    so i used wsSecurity-1.1 inside <featureManager>

    <feature>wsSecurity-1.1</feature>
    

    Also for sending credentials of username and password i was need to use next code for UsernameToken

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

    And not just adding UsernameToken into header using security SOAP element like that

    security.addChildElement("UsernameToken", "wsse");

    References

    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