Axis2 client code gives nullpointerexception.  Here is the client code:

public class SecureServiceCGClient {
    public static void main(String[] args) throws Exception {

        ConfigurationContext ctx =
ConfigurationContextFactory.createConfigurationContextFromFileSystem("C:\\IdeaProjects\\repo",
null);
        SecureServiceStub stub = new
SecureServiceStub(ctx,"https://localhost:8080/axis2/services/SecureService";);
        ServiceClient sc = stub._getServiceClient();
        sc.engageModule("rampart");
        Options options = new Options();
        options.setAction("urn:add");
        options.setTo(new
EndpointReference("http://127.0.0.1:8080/axis2/services/SecureService";));
        options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, 
loadPolicy("C:\\apache-tomcat-6.0.24\\webapps\\axis2\\WEB-INF\\services\\SecureService\\META-INF\\policy.xml"));
        sc.setOptions(options);

       /* Policy rampartConfig =
loadPolicy("C:\\apache-tomcat-6.0.24\\webapps\\axis2\\WEB-INF\\services\\SecureService\\META-INF\\policy.xml");
       
sc.getAxisService().getPolicyInclude().addPolicyElement(PolicyInclude.AXIS_SERVICE_POLICY,
rampartConfig);    */
        String a = "3";
        String b = "4";
        
        OMElement response = sc.sendReceive(getPayload(a, b));
        System.out.println(response);
    }



        private static Policy loadPolicy(String xmlPath) throws Exception {
            StAXOMBuilder builder = new StAXOMBuilder(xmlPath);
            return PolicyEngine.getPolicy(builder.getDocumentElement());
        }

    private static OMElement getPayload(String val, String val1) {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace ns =
factory.createOMNamespace("http://secureservice.tutorial.rampart.apache.org","ns1";);
        OMElement method = factory.createOMElement("add", ns);
        OMElement value1 = factory.createOMElement("value1", ns);
        value1.setText(val);
        method.addChild(value1);
        OMElement value2 = factory.createOMElement("value2", ns);
        value1.setText(val1);
        method.addChild(value2);
        return method;
    }

    
}


The exception is 
Exception in thread "main" 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: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
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:540)
        at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:521)
        at
tutorial.rampart.client.SecureServiceCGClient.main(SecureServiceCGClient.java:42)
Disconnected from the target VM, address: '127.0.0.1:3967', transport:
'socket'

Process finished with exit code 1

Any tips on resolving this will be helpful.

Thanks,
Monisha
-- 
View this message in context: 
http://old.nabble.com/serviceClient.sendRecieve-call-gives-nullpointer-in-the-Axis2-client-code-tp28113393p28113393.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to