Hi Martin, Thanks for the quick response.But I don't think it solves my issue. Am not using any Axiom code here.Test code is just a java program calling Neethi APIs for parsing the policy file.The policy file is a valid one.
Pls let me know if I misunderstood your response. --- On Mon, 4/7/11, JAYA KARTHIK <[email protected]> wrote: From: JAYA KARTHIK <[email protected]> Subject: Policy reference can not be resolved To: [email protected] Date: Monday, 4 July, 2011, 6:29 PM Hi, Am a new Apache Neethi user.I downloaded the latest Apache Neethi 3.0.0 binaries. On using <PolicyReference ..> I get the following exception when it tries to resolve the corresponding policy. Exception in thread "main" java.lang.RuntimeException: #PolicyID can't be resolved at org.apache.neethi.AbstractPolicyOperator.normalizeOperator(AbstractPolicyOperator.java:130) at org.apache.neethi.AbstractPolicyOperator.normalizeOperator(AbstractPolicyOperator.java:143) at org.apache.neethi.AbstractPolicyOperator.normalizeOperator(AbstractPolicyOperator.java:140) at org.apache.neethi.AbstractPolicyOperator.normalize(AbstractPolicyOperator.java:87) at org.apache.neethi.Policy.normalize(Policy.java:95) at org.apache.neethi.Policy$PolicyIterator.<init>(Policy.java:245) at org.apache.neethi.Policy.getAlternatives(Policy.java:235) at TestNeethi.test(TestNeethi.java:26) at TestNeethi.main(TestNeethi.java:18) Following is the test source code: public class TestNeethi{ public static void main(String args[])throws Exception{ new TestNeethi().test(args[0]); } public void test(String file) throws Exception{ Assertion ast=null; PolicyBuilder builder = new PolicyBuilder(); builder.setPolicyRegistry(new PolicyRegistryImpl()); Policy policy=builder.getPolicy(getResourceAsDOM(file)); Iterator it = policy.getAlternatives(); while(it.hasNext()){ List k =(ArrayList)it.next(); for(int g=0;g<k.size();g++){ ast = (org.apache.neethi.Assertion)k.get(g); System.out.println(ast.toString()); } } } public Element getResourceAsDOM(String name) throws ParserConfigurationException, SAXException, IOException { InputStream in = new FileInputStream(name); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setIgnoringComments(false); dbf.setIgnoringElementContentWhitespace(true); dbf.setNamespaceAware(true); DocumentBuilder db = null; db = dbf.newDocumentBuilder(); return db.parse(in).getDocumentElement(); } } Policy file used: <Policies xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsaws="http://www.w3.org/2005/08/addressing"> <wsp:Policy Name="OuterPolicy" > <wsp:All> <wsp:PolicyReference URI="#PolicyID"/> </wsp:All> </wsp:Policy> <wsp:Policy Name="TestPolicy" wsu:Id="PolicyID" > <wsp:All> <wsaws:UsingAddressing xmlns:wsaws="http://www.w3.org/2006/05/addressing/wsdl"/> </wsp:All> </wsp:Policy> </Policies> Not sure if am missing something.Could you please help me in resolving this? Thanks&Regards J.JayaKarthik.
