i dont believe Axis allows you to secure a SOAP entity (service,endpoint,port or message) with multiple policies you need to decide on which SOAP entity you want to secure and which policy will be applied to that entity http://axis.apache.org/axis2/c/rampart/docs/configurations.html http://blog.rampartfaq.com/2009/08/what-are-policy-subjects.html
here is an example where an Axis service is being secured via PolicyReference URI attribute http://fusesource.com/docs/esb/4.4/cxf_security/WsPolicy-Intro.html FWIW Martin ______________________________________________ Verzicht und Vertraulichkeitanmerkung Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Date: Mon, 4 Jul 2011 18:29:15 +0530 From: [email protected] Subject: Policy reference can not be resolved To: [email protected] 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.
