Hi,
I need some help with WS-Policy in CXF 2.2.4
I have been fighting to enable WS-Addressing using the WS-Addressing
Metadata policy assertions. I attahed a policy in my WSDL with:
<wsp:Policy wsu:Id='myPolicy'
xmlns:wsp='http://www.w3.org/ns/ws-policy'>
<wsam:Addressing
xmlns:wsam='http://www.w3.org/2007/05/addressing/metadata' >
<wsp:Policy/>
</wsam:Addressing>
</wsp:Policy>
Now, I have two separate CXF applications (the provider-app and the
client-app). Both activate the policy framework by:
1) Adding a dependency in their pom.xml to "cxf-rt-ws-policy"
2) Including in their spring "beans.xml" an
<import
resource="classpath:META-INF/cxf/cxf-extension-policy.xml" />
The problem is that when the provider has WS-Policy enabled, the
MAPAggregator throws an NPE.
So, if I do (1) and (2) for both the "client WAR" and the "provider
WAR", I get an NPE at the provider-side, while the incoming request is
being processed. If I remove (1) and (2), the policy still gets parsed
properly and Addressing headers are added by CXF in the client, without
the provider complaining. I assume that in this case the addressing
interceptors are not added to the endpoint of the provider, so it
doesn't attempt to process the WS-Addressing headers, thus avoiding the NPE.
The NullPointerException is thrown while the server processes the
request at:
java.lang.NullPointerException
at
org.apache.cxf.jaxws.interceptors.MessageModeOutInterceptor.doSoap(MessageModeOutInterceptor.java:149)
at
org.apache.cxf.jaxws.interceptors.MessageModeOutInterceptor.handleMessage(MessageModeOutInterceptor.java:82)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at
org.apache.cxf.ws.addressing.ContextUtils.rebaseResponse(ContextUtils.java:380)
at
org.apache.cxf.ws.addressing.MAPAggregator.mediate(MAPAggregator.java:355)
...
I looked at the CXF code and the catch() block which prints out the
above stack trace also logs:
WARNING: SERVER_TRANSPORT_REBASE_FAILURE_MSG
I'm using CXF 2.2.4 / Sun JDK 1.6.0_16 and get the same error when
deploying the "provider-app" on:
- Tomcat 6.0.20
- JBoss 5.1
- WebLogic 10.3.2
Any ideas what could be wrong?