I am attempting to create a Java client to call a .NET web service. I was provided a WSDL (which contains the security policy information) and used the Axis2 wsdl2java utility to generate the client stub.
Here is the code I use to initialize the stub:
ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("/path", null);
webService = new ERecordingStub(ctx);
ServiceClient client = webService._getServiceClient();
Options options = client.getOptions();
options.setUserName(username);
options.setPassword(password);
client.engageModule("rampart");
It seems as though I have Rampart configured correctly, because this code runs without any errors or exceptions.
However, when I actually make the stub call, I get the following exception:
org.apache.axis2.AxisFault: Error in obtaining a token
at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:70)
at org.apache.axis2.engine.Phase.invoke(Phase.java:318)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:251)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:416)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at simplifile.soap.csa.ERecordingStub.getDocumentTypes(ERecordingStub.java:778)
at simplifile.soap.csa.CSASubmission.getDocTypes(CSASubmission.java:116)
... 35 more
Caused by: org.apache.rampart.RampartException: Error in obtaining a token
at org.apache.rampart.util.RampartUtil.getToken(RampartUtil.java:787)
at org.apache.rampart.util.RampartUtil.getSecConvToken(RampartUtil.java:645)
at org.apache.rampart.builder.TransportBindingBuilder.handleSecureConversationTokens(TransportBindingBuilder.java:623)
at org.apache.rampart.builder.TransportBindingBuilder.build(TransportBindingBuilder.java:146)
at org.apache.rampart.MessageBuilder.build(MessageBuilder.java:140)
at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:64)
... 43 more
Caused by: java.lang.NullPointerException
at org.apache.neethi.AbstractPolicyOperator.normalizeOperator(AbstractPolicyOperator.java:97)
at org.apache.neethi.AbstractPolicyOperator.normalize(AbstractPolicyOperator.java:73)
at org.apache.neethi.Policy.normalize(Policy.java:64)
at org.apache.neethi.Policy.normalize(Policy.java:49)
at org.apache.neethi.Policy$PolicyIterator.(Policy.java:200)
at org.apache.neethi.Policy.getAlternatives(Policy.java:193)
at org.apache.rahas.client.STSClient.processPolicy(STSClient.java:476)
at org.apache.rahas.client.STSClient.requestSecurityToken(STSClient.java:145)
at org.apache.rampart.util.RampartUtil.getToken(RampartUtil.java:774)
... 48 more
Am I possibly forgetting to set a property other than the username/password? Could my Rampart set-up be wrong? Or is it an issue with the vendor I'm working with?
Any help is appreciated!