Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
1.4
-
None
Description
Rampart 1.4 assumes WSS10 or WSS11 to be present in the policy. This is not a mandatory requirement and we must use defaults if those assertions are not present.
Exception:java.lang.NullPointerException
java.lang.NullPointerException
at org.apache.rampart.util.RampartUtil.setKeyIdentifierType(RampartUtil.java:1141)
at org.apache.rampart.builder.BindingBuilder.getSignatureBuider(BindingBuilder.java:243)
at org.apache.rampart.builder.AsymmetricBindingBuilder.doSignature(AsymmetricBindingBuilder.java:626)
at org.apache.rampart.builder.AsymmetricBindingBuilder.doSignBeforeEncrypt(AsymmetricBindingBuilder.java:413)
at org.apache.rampart.builder.AsymmetricBindingBuilder.build(AsymmetricBindingBuilder.java:93)
at org.apache.rampart.MessageBuilder.build(MessageBuilder.java:147)
at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:64)
at org.apache.axis2.engine.Phase.invoke(Phase.java:317)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:264)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:429)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:401)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at com.my.ws.test.JmeterserviceSecStub.addition(JmeterserviceSecStub.java:240)
at com.my.ws.test.TestClient.main(TestClient.java:57)
The code appears to want a Wss10 or Wss11 Assertion in the list of assertions on the message context.
But there are none so this line causes a null pointer:
public class RampartUtil
...
public static void setKeyIdentifierType(RampartPolicyData rpd, WSSecBase secBase,org.apache.ws.secpolicy.model.Token token) {
....
if (wss.isMustSupportRefKeyIdentifier()) {
Adding this to the policy fixes the error:
<sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:MustSupportRefKeyIdentifier/>
<sp:MustSupportRefIssuerSerial/>
</wsp:Policy>
</sp:Wss10>