Author: ema
Date: Thu Jul 1 06:45:35 2010
New Revision: 959535
URL: http://svn.apache.org/viewvc?rev=959535&view=rev
Log:
[CXF-2850]:Throw Message Addressing property is not present exception when the
wsa policy is violated
Modified:
cxf/trunk/rt/ws/policy/pom.xml
cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java
Modified: cxf/trunk/rt/ws/policy/pom.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/pom.xml?rev=959535&r1=959534&r2=959535&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/pom.xml (original)
+++ cxf/trunk/rt/ws/policy/pom.xml Thu Jul 1 06:45:35 2010
@@ -61,6 +61,11 @@
<artifactId>cxf-rt-core</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-bindings-soap</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!-- Test stuff -->
<dependency>
<groupId>org.apache.cxf</groupId>
Modified:
cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java?rev=959535&r1=959534&r2=959535&view=diff
==============================================================================
---
cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java
(original)
+++
cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java
Thu Jul 1 06:45:35 2010
@@ -21,7 +21,10 @@ package org.apache.cxf.ws.policy;
import java.util.logging.Logger;
+import javax.xml.namespace.QName;
+
import org.apache.cxf.Bus;
+import org.apache.cxf.binding.soap.SoapFault;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.message.Exchange;
@@ -92,8 +95,19 @@ public class PolicyVerificationInInterce
effectivePolicy = pe.getEffectiveServerRequestPolicy(ei, boi);
}
}
-
- aim.checkEffectivePolicy(effectivePolicy.getPolicy());
+ try {
+ aim.checkEffectivePolicy(effectivePolicy.getPolicy());
+ } catch (PolicyException ex) {
+ //To check if there is ws addressing policy violation and throw
WSA specific
+ //exception to pass jaxws2.2 tests
+ if (ex.getMessage().indexOf("Addressing") > -1) {
+ throw new SoapFault("A required header representing a Message
Addressing Property "
+ + "is not present",
+ new
QName("http://www.w3.org/2005/08/addressing",
+
"MessageAddressingHeaderRequired"));
+ }
+ throw ex;
+ }
LOG.fine("Verified policies for inbound message.");
}