Hello
I am getting following error while securing my web service using rampart .
Please help us on this . It worrked fine once but now it is failing.
Aug 5, 2008 4:38:17 PM org.apache.axis2.deployment.DeploymentEngine prepareRepository
INFO: No services directory was found under /home/rajnishc/client-repo.
Aug 5, 2008 4:38:18 PM org.apache.axis2.deployment.ModuleDeployer deploy
INFO: Deploying module: rampart-1.3
org.apache.axis2.AxisFault: Unable to engage module : rampart
at org.apache.axis2.client.ServiceClient.engageModule(ServiceClient.java:339)
at Test.main(Test.java:47)
org.apache.axis2.AxisFault: java.lang.NullPointerException
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:486)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:343)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at st.ict.qs.lems.secure.adb.client.EventServiceStub.createEvent(EventServiceStub.java:190)
at Test.main(Test.java:67)
Exception in thread "main" java.lang.NullPointerException
at Test.main(Test.java:75)
Client code is same as
System.setProperty("javax.net.ssl.trustStore", "/home/rajnishc/keys/server.jks");
System.setProperty("javax.net.ssl.trustStorePassword", "password");
//To be able to load the client configuration from axis2.xml
ConfigurationContext ctx = null;
try {
ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("/home/rajnishc/client-repo", null);
} catch (AxisFault e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
EventServiceStub stub = null;
try {
stub = new EventServiceStub("https://10.199.48.42:8443/axis2/services/EventService");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ServiceClient sc = stub._getServiceClient();
try {
sc.engageModule("rampart");
} catch (AxisFault e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Options options = sc.getOptions();
options.setUserName("lems_ws");
options.setPassword("lems_ws_123");
My service.xml is as
<serviceGroup>
<service name="EventService" class="st.ict.qs.ws.spring.SpringInit">
<module ref="rampart"/>
<messageReceivers>
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
<messageReceiver
mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</messageReceivers>
<parameter name="ServiceClass">
st.ict.qs.ws.EventService
</parameter>
<parameter name="useOriginalwsdl">false</parameter>
<parameter name="modifyUserWSDLPortAddress">true</parameter>
<!-- need the TCCL param when using spring inside the AAR -->
<parameter name="ServiceTCCL">composite</parameter>
<parameter name="ServiceObjectSupplier">org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier</parameter>
<parameter name="SpringBeanName">eventService</parameter>
<operation name="createEvent">
<actionMapping>urn:createEvent</actionMapping>
<outputActionMapping>
urn:createEventResponse
</outputActionMapping>
</operation>
<wsp:Policy wsu:Id="UTOverTransport" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpsToken RequireClientCertificate="false"/>
</wsp:Policy>
</sp:TransportToken>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic256/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Lax/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
</wsp:Policy>
</sp:TransportBinding>
<sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" />
</wsp:Policy>
</sp:SignedSupportingTokens>
<ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
<ramp:passwordCallbackClass>st.ict.qs.ws.PWCBHandler</ramp:passwordCallbackClass>
</ramp:RampartConfig>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
</service>
</serviceGroup>
Make sure to have modules directory: /home/rajnishc/client-repo
problem solved