You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2012/01/29 00:25:35 UTC
svn commit: r1237184 - in /axis/axis1/java/trunk/axis/src/test:
java/test/message/TestSOAPFault.java resources/test/message/AXIS-2705.xml
Author: veithen
Date: Sat Jan 28 23:25:35 2012
New Revision: 1237184
URL: http://svn.apache.org/viewvc?rev=1237184&view=rev
Log:
Designed a test case for AXIS-2705.
Added:
axis/axis1/java/trunk/axis/src/test/resources/test/message/AXIS-2705.xml (with props)
Modified:
axis/axis1/java/trunk/axis/src/test/java/test/message/TestSOAPFault.java
Modified: axis/axis1/java/trunk/axis/src/test/java/test/message/TestSOAPFault.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis/src/test/java/test/message/TestSOAPFault.java?rev=1237184&r1=1237183&r2=1237184&view=diff
==============================================================================
--- axis/axis1/java/trunk/axis/src/test/java/test/message/TestSOAPFault.java (original)
+++ axis/axis1/java/trunk/axis/src/test/java/test/message/TestSOAPFault.java Sat Jan 28 23:25:35 2012
@@ -17,14 +17,20 @@ package test.message;
import junit.framework.TestCase;
+import javax.xml.soap.Detail;
import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPFault;
import javax.xml.soap.SOAPMessage;
import java.io.InputStream;
+import java.util.Iterator;
/**
* @author steve.johnson@riskmetrics.com (Steve Johnson)
* @author Davanum Srinivas (dims@yahoo.com)
+ * @author Andreas Veithen
+ *
* @version $Revision$
*/
public class TestSOAPFault extends TestCase {
@@ -49,4 +55,31 @@ public class TestSOAPFault extends TestC
in.close();
}
}
+
+ /**
+ * Regression test for AXIS-2705. The issue occurs when a SOAP fault has a detail element
+ * containing text (and not elements). Note that such a SOAP fault violates the SOAP spec, but
+ * Axis should nevertheless be able to process it.
+ *
+ * @throws Exception
+ */
+ public void _testAxis2705() throws Exception {
+ InputStream in = TestSOAPFault.class.getResourceAsStream("AXIS-2705.xml");
+ try {
+ MessageFactory msgFactory = MessageFactory.newInstance();
+ SOAPMessage msg = msgFactory.createMessage(null, in);
+ SOAPBody body = msg.getSOAPPart().getEnvelope().getBody();
+ assertTrue(body.hasFault());
+ SOAPFault fault = body.getFault();
+ Detail detail = fault.getDetail();
+ assertNotNull(detail);
+ Iterator it = detail.getChildElements();
+ assertTrue(it.hasNext());
+ SOAPElement detailElement = (SOAPElement)it.next();
+ assertNull(detailElement.getNamespaceURI());
+ assertEquals("text", detailElement.getLocalName());
+ } finally {
+ in.close();
+ }
+ }
}
\ No newline at end of file
Added: axis/axis1/java/trunk/axis/src/test/resources/test/message/AXIS-2705.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis/src/test/resources/test/message/AXIS-2705.xml?rev=1237184&view=auto
==============================================================================
--- axis/axis1/java/trunk/axis/src/test/resources/test/message/AXIS-2705.xml (added)
+++ axis/axis1/java/trunk/axis/src/test/resources/test/message/AXIS-2705.xml Sat Jan 28 23:25:35 2012
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+ <soapenv:Body>
+ <soapenv:Fault>
+ <faultcode>soapenv:Server</faultcode>
+ <faultstring>some fault string</faultstring>
+ <detail>test</detail>
+ </soapenv:Fault>
+ </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file
Propchange: axis/axis1/java/trunk/axis/src/test/resources/test/message/AXIS-2705.xml
------------------------------------------------------------------------------
svn:eol-style = native