PolicyException on incorrect policy namespace
---------------------------------------------

                 Key: CXF-1302
                 URL: https://issues.apache.org/jira/browse/CXF-1302
             Project: CXF
          Issue Type: Bug
    Affects Versions: 2.0.3
            Reporter: Thomas Diesler


I'm trying to integrate CXF WS-RM into JBoss

>From the example on the wiki I use

<beans xmlns='http://www.springframework.org/schema/beans' 
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' 
xmlns:beans='http://www.springframework.org/schema/beans'
  xmlns:jaxws='http://cxf.apache.org/jaxws' 
xmlns:p="http://cxf.apache.org/policy";
  xsi:schemaLocation='http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd 
  http://www.w3.org/2006/07/ws-policy http://www.w3.org/2006/11/ws-policy.xsd
  http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd'>
  
  <wsp:Policy wsu:Id="RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"; 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";>
    <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata";>
      <wsp:Policy/>
    </wsam:Addressing>
    <wsrmp:RMAssertion 
xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy";>
      <wsrmp:BaseRetransmissionInterval Milliseconds="10000"/>
    </wsrmp:RMAssertion>
  </wsp:Policy>
  
  <jaxws:endpoint id='TestService' 
address='http://@jboss.bind.address@:8080/jaxws-cxf-reliable' 
implementor='org.jboss.test.ws.jaxws.cxf.reliable.RMEndpointImpl'>
    
    <jaxws:invoker>
      <bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/>
    </jaxws:invoker>
    
    <jaxws:features>
      <p:policies>
        <wsp:PolicyReference URI="#RM" 
xmlns:wsp="http://www.w3.org/2006/07/ws-policy"/>
      </p:policies>
    </jaxws:features>
    
  </jaxws:endpoint>
  
</beans>

This leads to 

Caused by: org.apache.cxf.ws.policy.PolicyException: Expected exactly one child 
element of type {http://www.w3.org/ns/ws-policy}Policy.
        at 
org.apache.cxf.ws.policy.builder.primitive.NestedPrimitiveAssertion.<init>(NestedPrimitiveAssertion.java:70)
        at 
org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder.build(AddressingAssertionBuilder.java:74)
        at 
org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl.build(AssertionBuilderRegistryImpl.java:102)
        at 
org.apache.cxf.ws.policy.PolicyBuilderImpl.processOperationElement(PolicyBuilderImpl.java:185)
        at 
org.apache.cxf.ws.policy.PolicyBuilderImpl.getPolicyOperator(PolicyBuilderImpl.java:123)
        at 
org.apache.cxf.ws.policy.PolicyBuilderImpl.getPolicy(PolicyBuilderImpl.java:119)

because of 

            if (Constants.URI_POLICY_NS.equals(namespaceURI)) {

                if (Constants.ELEM_POLICY.equals(localName)) {
                    
operator.addPolicyComponent(getPolicyOperator(childElement));

                } else if (Constants.ELEM_EXACTLYONE.equals(localName)) {
                    
operator.addPolicyComponent(getExactlyOneOperator(childElement));

                } else if (Constants.ELEM_ALL.equals(localName)) {
                    operator.addPolicyComponent(getAllOperator(childElement));

                } else if (Constants.ELEM_POLICY_REF.equals(localName)) {
                    
operator.addPolicyComponent(getPolicyReference(childElement));
                }

            } else if (null != assertionBuilderRegistry) {
                Assertion a = assertionBuilderRegistry.build(childElement);
                if (null != a) {
                    operator.addPolicyComponent(a);
                }
            }

It seems that only http://schemas.xmlsoap.org/ws/2004/09/policy

is a valid policy namespace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to