eclipse-ee4j / eclipse-ee4j/metro-wsit
com.sun.xml.wss.impl.WssSoapFaultException: ERROR: Policy for the service could not be obtained
- Dominant language
- Java
- Stars
- 6
- Forks
- 21
- Avg merge
- 10h 2m
- Merged PRs (30d)
- 1
Description
Hi Team,
We are facing below issue with webservice
javax.xml.ws.WebServiceException: WSSTUBE0025: Fehler bei der Prüfung der Sicherheit in der eingehenden Nachricht.
at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processClientResponsePacket(SecurityClientTube.java:412)
at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processResponse(SecurityClientTube.java:334) ~
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1116) ~
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1019) ~
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:988)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:846)
at com.sun.xml.ws.client.Stub.process(Stub.java:432) ~
at com.sun.xml.ws.client.dispatch.DispatchImpl.doInvoke(DispatchImpl.java:235) ~
at com.sun.xml.ws.client.dispatch.DispatchImpl.invoke(DispatchImpl.java:274) ~
Caused by: javax.xml.ws.soap.SOAPFaultException: ERROR: Policy for the service could not be obtained
at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.getSOAPFaultException(SecurityTubeBase.java:686)
at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.getSOAPFaultException(SecurityTubeBase.java:704)
... 19 more
Caused by: com.sun.xml.wss.impl.WssSoapFaultException: ERROR: Policy for the service could not be obtained
at com.sun.xml.wss.impl.SecurableSoapMessage.newSOAPFaultException(SecurableSoapMessage.java:319)
at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.getSOAPFaultException(SecurityTubeBase.java:701) ~]
... 19 more
Caused by: com.sun.xml.wss.impl.PolicyViolationException: ERROR: Policy for the service could not be obtained
at com.sun.xml.wss.impl.policy.verifier.MessagePolicyVerifier.verifyPolicy(MessagePolicyVerifier.java:104) ~
at com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.createMessage(SecurityRecipient.java:1007)
at com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.validateMessage(SecurityRecipient.java:242)
at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.verifyInboundMessage(SecurityTubeBase.java:426) ~
at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processClientResponsePacket(SecurityClientTube.java:406) ~
Below is the WSDL configuration:
We have debugged found that Metro MessagePolicyVerifier below logic expects only Timestamp policy but our response had SignaturePolicy
if(actualPolicy == null || actualPolicy.size() <= 0){
if ((inferredSecurityPolicy != null) && (inferredSecurityPolicy.size() > 0)) {
//this could be a plain SSL scenario
if (!checkAllowExtraTimestamp(inferredSecurityPolicy)) {
log.log(Level.SEVERE, LogStringsMessages.WSS_0805_POLICY_NULL());
throw new PolicyViolationException("ERROR: Policy for the service could not be obtained");
}
}
}
private boolean checkAllowExtraTimestamp(MessagePolicy inferredSecurityPolicy) {
//assumption : inferredSecurityPolicy != null and size > 0
if (inferredSecurityPolicy.size() > 1) {
return false;
}
SecurityPolicy pol = null;
try {
pol = inferredSecurityPolicy.get(0);
} catch (Exception ex) {
//ignore for now;
}
return pol instanceof TimestampPolicy;
}
Could please explain share some more insight for expecting only TimestampPolicy here.
Contributor guide
Research direction
Start with MessagePolicyVerifier.verifyPolicy and its checkAllowExtraTimestamp logic, then compare the WSDL policy references and the response's SignaturePolicy described in the report. Trace how SecurityRecipient validates the inbound message and determine whether the verifier should handle this policy combination. Done means documenting or correcting the expected policy handling with a regression test for the reported response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100