Webservices - Axis2 ClientStub policy error

582 Views Asked by At

Trying to invoke a webservice usign the AXIS genereated client stubs .

When i run my standalone java program am getting

    Exception in thread "main" java.lang.NullPointerException
    at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:201)

The getPolicy() method in the stub class

return org.apache.neethi.PolicyEngine.getPolicy    (org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(
           new java.io.StringReader(policyString)).getDocument().getXMLStreamReader(false));    

Why is that am getting NullPointerException?

I tried splitting the code like below. But still getting teh same NullPointerException

 System.out.println("policy String :" + policyString);

    OMXMLParserWrapper omp = org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(
            new java.io.StringReader(policyString));
    System.out.println("Step 2 :" + omp);

    XMLStreamReader omd = omp.getDocument().getXMLStreamReader(false);
    System.out.println("Step 3 " + omd);
    Policy policy = org.apache.neethi.PolicyEngine.getPolicy(omd);
    System.out.println("Step 4");
    return policy;

Has anyone faced this kind of error ? Any advice is highly appreciated

1

There are 1 best solutions below

0
On

The issue got fixed. The stubs were generated behind a firewall and was throwing this exception. I generated the stubs outside of firewall and it works like a charm