Author: dkulp
Date: Fri Mar 30 13:27:33 2012
New Revision: 1307403
URL: http://svn.apache.org/viewvc?rev=1307403&view=rev
Log:
[CXF-4181] Fix for SAAJ + SOAP 1.2 fault...
Modified:
cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java
Modified:
cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java?rev=1307403&r1=1307402&r2=1307403&view=diff
==============================================================================
---
cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
(original)
+++
cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
Fri Mar 30 13:27:33 2012
@@ -229,38 +229,42 @@ public class SAAJInInterceptor extends A
if (hasFault(message, xmlReader)) {
- SOAPFault soapFault =
-
soapMessage.getSOAPPart().getEnvelope().getBody().addFault();
SoapFault fault =
message.getVersion() instanceof Soap11
? Soap11FaultInInterceptor.unmarshalFault(message,
xmlReader)
: Soap12FaultInInterceptor.unmarshalFault(message,
xmlReader);
- if (fault.getFaultCode() != null) {
- SAAJUtils.setFaultCode(soapFault, fault.getFaultCode());
- }
- if (fault.getMessage() != null) {
- soapFault.setFaultString(fault.getMessage());
- }
- if (fault.getRole() != null) {
- soapFault.setFaultActor(fault.getRole());
- }
- if (fault.getDetail() != null
- && fault.getDetail().getFirstChild() != null) {
- Detail detail = null;
- Node child = fault.getDetail().getFirstChild();
- while (child != null) {
- if (Node.ELEMENT_NODE == child.getNodeType()) {
- if (detail == null) {
- detail = soapFault.addDetail();
+ SOAPFault soapFault =
+
soapMessage.getSOAPPart().getEnvelope().getBody().getFault();
+ if (soapFault == null) {
+ soapFault =
+
soapMessage.getSOAPPart().getEnvelope().getBody().addFault();
+ if (fault.getFaultCode() != null) {
+ SAAJUtils.setFaultCode(soapFault,
fault.getFaultCode());
+ }
+ if (fault.getMessage() != null) {
+ soapFault.setFaultString(fault.getMessage());
+ }
+ if (fault.getRole() != null) {
+ soapFault.setFaultActor(fault.getRole());
+ }
+ if (fault.getDetail() != null
+ && fault.getDetail().getFirstChild() != null) {
+
+ Detail detail = null;
+ Node child = fault.getDetail().getFirstChild();
+ if (child != null) {
+ detail = soapFault.addDetail();
+ }
+ while (child != null) {
+ if (Node.ELEMENT_NODE == child.getNodeType()) {
+ Node importedChild =
soapMessage.getSOAPPart().importNode(child, true);
+ detail.appendChild(importedChild);
}
- Node importedChild =
soapMessage.getSOAPPart().importNode(child, true);
- detail.appendChild(importedChild);
+ child = child.getNextSibling();
}
- child = child.getNextSibling();
}
}
-
DOMSource bodySource = new DOMSource(soapFault);
xmlReader = StaxUtils.createXMLStreamReader(bodySource);
} else {
Modified:
cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java?rev=1307403&r1=1307402&r2=1307403&view=diff
==============================================================================
---
cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java
(original)
+++
cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java
Fri Mar 30 13:27:33 2012
@@ -45,7 +45,6 @@ import org.apache.cxf.binding.soap.inter
import org.apache.cxf.headers.Header;
import org.apache.cxf.interceptor.StaxInInterceptor;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
@@ -141,7 +140,6 @@ public class SAAJInInterceptorTest exten
}
@Test
- @Ignore
public void testFaultDetailSOAP12() throws Exception {
try {
prepareSoapMessage("../test-soap-12-fault-detail.xml");