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 2010/10/30 23:56:50 UTC

svn commit: r1029210 [1/3] - in /axis/axis2/java/core/branches/1_5: ./ modules/distribution/ modules/kernel/src/org/apache/axis2/transport/http/util/ modules/kernel/test/org/apache/axis2/transport/http/util/ modules/parent/ modules/saaj/ modules/saaj/s...

Author: veithen
Date: Sat Oct 30 21:56:49 2010
New Revision: 1029210

URL: http://svn.apache.org/viewvc?rev=1029210&view=rev
Log:
Merged another set of SAAJ fixes to the 1.5 branch.

Merged revisions: 733540,733900,733910,734227,734237,734261,738057,738067,738071,738086,738110,738113,738117,738158,740332,740357,740360,741300,741784,741878,741881

Issues fixed: AXIS2-1014, AXIS2-4189, AXIS2-4202, AXIS2-4231

Added:
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SAAJTestRunner.java
      - copied, changed from r733910, webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJTestRunner.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/TestConstants.java
      - copied unchanged from r738110, webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/TestConstants.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/Validated.java
      - copied unchanged from r733910, webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/Validated.java
Removed:
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SAAJTestUtil.java
Modified:
    axis/axis2/java/core/branches/1_5/   (props changed)
    axis/axis2/java/core/branches/1_5/modules/distribution/   (props changed)
    axis/axis2/java/core/branches/1_5/modules/kernel/src/org/apache/axis2/transport/http/util/QueryStringParser.java   (props changed)
    axis/axis2/java/core/branches/1_5/modules/kernel/test/org/apache/axis2/transport/http/util/QueryStringParserTest.java   (props changed)
    axis/axis2/java/core/branches/1_5/modules/parent/   (props changed)
    axis/axis2/java/core/branches/1_5/modules/saaj/pom.xml
    axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/MessageFactoryImpl.java
    axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
    axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java
    axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java
    axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java
    axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/util/SAAJUtil.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test-resources/message.bin
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/AttachmentSerializationTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/MessageFactoryTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/NodeTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/PrefixesTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SAAJDetailTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SAAJResultTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPBodyTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPConnectionTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPElementTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPEnvelopeTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPFactoryTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultDetailTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPHeaderTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPMessageTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPNamespaceTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/TextTest.java
    axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java
    axis/axis2/java/core/branches/1_5/modules/soapmonitor/module/   (props changed)
    axis/axis2/java/core/branches/1_5/modules/soapmonitor/module/pom.xml   (props changed)
    axis/axis2/java/core/branches/1_5/modules/soapmonitor/module/src/main/java/org/apache/axis2/handlers/   (props changed)
    axis/axis2/java/core/branches/1_5/modules/soapmonitor/module/src/main/resources/META-INF/module.xml   (props changed)
    axis/axis2/java/core/branches/1_5/modules/soapmonitor/servlet/   (props changed)
    axis/axis2/java/core/branches/1_5/modules/soapmonitor/servlet/src/main/java/org/apache/axis2/soapmonitor/applet/   (props changed)
    axis/axis2/java/core/branches/1_5/modules/soapmonitor/servlet/src/main/java/org/apache/axis2/soapmonitor/servlet/   (props changed)
    axis/axis2/java/core/branches/1_5/modules/transport/http/pom.xml   (props changed)
    axis/axis2/java/core/branches/1_5/modules/transport/http/src/   (props changed)
    axis/axis2/java/core/branches/1_5/modules/transport/local/   (props changed)
    axis/axis2/java/core/branches/1_5/modules/webapp/src/main/java/org/apache/axis2/webapp/AdminAgent.java   (props changed)
    axis/axis2/java/core/branches/1_5/modules/webapp/src/main/java/org/apache/axis2/webapp/AxisAdminServlet.java   (props changed)

Propchange: axis/axis2/java/core/branches/1_5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Oct 30 21:56:49 2010
@@ -1,2 +1,2 @@
 /axis/axis2/java/core/trunk:922914,922941,922983,935169,935174,935338,944347,944915,951385,960693,960976,960978,960984,960995,961012,961964,962844,963081,963147,965032,965036,965056,965068,965074,965213,965268,965277,965302,965454,966371,966401,966428,979882-979883,979886,981036,981038,981095,981188,981220-981221,981237,981262,981278,981293,981306,981311,981985,982387,982393,982795,982800,983101,983110,983114,983119-983120,983128,983185,983236,983270,983276,983280,983316,983363,983370,983372,985458,985464,985626,985634,985661,985715,985717,985744,985748,985752,985763,985791,985796,985851,986844,986889,987313,987712-987715,987783,987832,987873,987883,987913,987935,990350,990369,990377,990384,990394,990398,990404,990434,990449,1001279,1001452,1029153
-/webservices/axis2/trunk/java:728674,731798,732539,732541,732873,732877,732924,732927,732939,733293,733295,733304,733306,733348,733354,733394,733399,733463-733464,733533,733539,733676,733776,741873,748761,751964,754458,754467,754503,757151-757153,759488,759507,759878,759968,761025,761044,761709,761770,761952,763148,765102,771051,777648,777882,777897,777934,778060,780546,783479,795431,801630,803725,805578,805981,805999,806085,806331,807160,807487,807512,816740,816804,816812,816891,817965,821686,821689,834058,834175,902271,904660,904780,905980
+/webservices/axis2/trunk/java:728674,731798,732539,732541,732873,732877,732924,732927,732939,733293,733295,733304,733306,733348,733354,733394,733399,733463-733464,733533,733539-733540,733676,733776,733900,733910,734227,734237,734261,738057,738067,738071,738086,738110,738113,738117,738158,740332,740357,740360,741300,741784,741873,741878,741881,748761,751964,754458,754467,754503,757151-757153,759488,759507,759878,759968,761025,761044,761709,761770,761952,763148,765102,771051,777648,777882,777897,777934,778060,780546,783479,795431,801630,803725,805578,805981,805999,806085,806331,807160,807487,807512,816740,816804,816812,816891,817965,821686,821689,834058,834175,902271,904660,904780,905980

Propchange: axis/axis2/java/core/branches/1_5/modules/distribution/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Oct 30 21:56:49 2010
@@ -1,2 +1,2 @@
 /axis/axis2/java/core/trunk/modules/distribution:922914,922941,922983,935169,935174,935338,936434,944347,944915,951385,960693,960976,960978,960984,960995,961012,961964,962844,963081,963147,965032,965036,965056,965068,965074,965213,965268,965277,965302,965454,966371,966401,966428,979882-979883,979886,981036,981038,981095,981188,981220-981221,981237,981262,981278,981293,981306,981311,981985,982387,982393,982795,982800,983101,983110,983114,983119-983120,983128,983185,983236,983270,983276,983280,983316,983363,983370,983372,985458,985464,985626,985634,985661,985715,985717,985744,985748,985752,985763,985791,985796,985851,986844,986889,987313,987712-987715,987783,987832,987873,987883,987913,987935,990350,990369,990377,990384,990394,990398,990404,990434,990449,1001279,1001452,1029153
-/webservices/axis2/trunk/java/modules/distribution:728674,731798,732539,732541,732873,732877,732924,732927,732939,733293,733295,733304,733306,733348,733354,733394,733399,733463-733464,733533,733539,733676,733776,741873,748761,751964,754458,754467,754503,757151-757153,759488,759507,759878,759968,761025,761044,761709,761770,761952,763148,765102,771051,777648,777882,777897,777934,778060,780546,783479,795431,801630,803725,805578,805981,805999,806085,806331,807160,807487,807512,816740,816804,816812,816891,817965,821686,821689,834058,834175,902271,904660,904780,905980
+/webservices/axis2/trunk/java/modules/distribution:728674,731798,732539,732541,732873,732877,732924,732927,732939,733293,733295,733304,733306,733348,733354,733394,733399,733463-733464,733533,733539-733540,733676,733776,733900,733910,734227,734237,734261,738057,738067,738071,738086,738110,738113,738117,738158,740332,740357,740360,741300,741784,741873,741878,741881,748761,751964,754458,754467,754503,757151-757153,759488,759507,759878,759968,761025,761044,761709,761770,761952,763148,765102,771051,777648,777882,777897,777934,778060,780546,783479,795431,801630,803725,805578,805981,805999,806085,806331,807160,807487,807512,816740,816804,816812,816891,817965,821686,821689,834058,834175,902271,904660,904780,905980

Propchange: axis/axis2/java/core/branches/1_5/modules/kernel/src/org/apache/axis2/transport/http/util/QueryStringParser.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Oct 30 21:56:49 2010
@@ -1,2 +1,2 @@
 /axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/util/QueryStringParser.java:922914,922941,922983,935169,935174,935338,944347,944915,951385,960693,960976,960978,960984,960995,961012,961964,962844,963081,963147,965032,965036,965056,965068,965074,965213,965268,965277,965302,965454,966371,966401,966428,979882-979883,979886,981036,981038,981095,981188,981220-981221,981237,981262,981278,981293,981306,981311,981985,982387,982393,982795,982800,983101,983110,983114,983119-983120,983128,983185,983236,983270,983276,983280,983316,983363,983370,983372,985458,985464,985626,985634,985661,985715,985717,985744,985748,985752,985763,985791,985796,985851,986844,986889,987313,987712-987715,987783,987832,987873,987883,987913,987935,990350,990369,990377,990384,990394,990398,990404,990434,990449,1001279,1001452,1029153
-/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/QueryStringParser.java:728674,731798,732539,732541,732873,732877,733293,733295,733304,733306,733348,733354,733394,733399,733463-733464,733533,733539,733676,751964,761709,771051,777648,777882,777897,777934,778060,780546,783479,795431,801630,803725,805578,805981,805999,806085,806331,807160,807487,807512,816740,816804,816812,816891,817965,821686,821689,834058,834175,902271,904660,904780,905980
+/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/QueryStringParser.java:728674,731798,732539,732541,732873,732877,733293,733295,733304,733306,733348,733354,733394,733399,733463-733464,733533,733539-733540,733676,733900,733910,734227,734237,734261,738057,738067,738071,738086,738110,738113,738117,738158,740332,740357,740360,741300,741784,741878,741881,751964,761709,771051,777648,777882,777897,777934,778060,780546,783479,795431,801630,803725,805578,805981,805999,806085,806331,807160,807487,807512,816740,816804,816812,816891,817965,821686,821689,834058,834175,902271,904660,904780,905980

Propchange: axis/axis2/java/core/branches/1_5/modules/kernel/test/org/apache/axis2/transport/http/util/QueryStringParserTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Oct 30 21:56:49 2010
@@ -1,2 +1,2 @@
 /axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/transport/http/util/QueryStringParserTest.java:922914,922941,922983,935169,935174,935338,944347,944915,951385,960693,960976,960978,960984,960995,961012,961964,962844,963081,963147,965032,965036,965056,965068,965074,965213,965268,965277,965302,965454,966371,966401,966428,979882-979883,979886,981036,981038,981095,981188,981220-981221,981237,981262,981278,981293,981306,981311,981985,982387,982393,982795,982800,983101,983110,983114,983119-983120,983128,983185,983236,983270,983276,983280,983316,983363,983370,983372,985458,985464,985626,985634,985661,985715,985717,985744,985748,985752,985763,985791,985796,985851,986844,986889,987313,987712-987715,987783,987832,987873,987883,987913,987935,990350,990369,990377,990384,990394,990398,990404,990434,990449,1001279,1001452,1029153
-/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/transport/http/util/QueryStringParserTest.java:728674,731798,732539,732541,732873,732877,733293,733295,733304,733306,733348,733354,733394,733399,733463-733464,733533,733539,733676,751964,761709,771051,777648,777882,777897,777934,778060,780546,783479,795431,801630,803725,805578,805981,805999,806085,806331,807160,807487,807512,816740,816804,816812,816891,817965,821686,821689,834058,834175,902271,904660,904780,905980
+/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/transport/http/util/QueryStringParserTest.java:728674,731798,732539,732541,732873,732877,733293,733295,733304,733306,733348,733354,733394,733399,733463-733464,733533,733539-733540,733676,733900,733910,734227,734237,734261,738057,738067,738071,738086,738110,738113,738117,738158,740332,740357,740360,741300,741784,741878,741881,751964,761709,771051,777648,777882,777897,777934,778060,780546,783479,795431,801630,803725,805578,805981,805999,806085,806331,807160,807487,807512,816740,816804,816812,816891,817965,821686,821689,834058,834175,902271,904660,904780,905980

Propchange: axis/axis2/java/core/branches/1_5/modules/parent/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Oct 30 21:56:49 2010
@@ -1,2 +1,2 @@
 /axis/axis2/java/core/trunk/modules/parent:922914,922941,922983,935169,935174,935338,936434,944347,944915,951385,960693,960976,960978,960984,960995,961012,961964,962844,963081,963147,965032,965036,965056,965068,965074,965213,965268,965277,965302,965454,966371,966401,966428,979882-979883,979886,981036,981038,981095,981188,981220-981221,981237,981262,981278,981293,981306,981311,981985,982387,982393,982795,982800,983101,983110,983114,983119-983120,983128,983185,983236,983270,983276,983280,983316,983363,983370,983372,985458,985464,985626,985634,985661,985715,985717,985744,985748,985752,985763,985791,985796,985851,986844,986889,987313,987712-987715,987783,987832,987873,987883,987913,987935,990350,990369,990377,990384,990394,990398,990404,990434,990449,1001279,1001452,1029153
-/webservices/axis2/trunk/java/modules/parent:728674,731798,732539,732541,732873,732877,732924,732927,732939,733293,733295,733304,733306,733348,733354,733394,733399,733463-733464,733533,733539,733676,733776,741873,748761,751964,754458,754467,754503,757151-757153,759488,759507,759878,759968,761025,761044,761709,761770,761952,763148,765102,771051,777648,777882,777897,777934,778060,780546,783479,795431,801630,803725,805578,805981,805999,806085,806331,807160,807487,807512,816740,816804,816812,816891,817965,821686,821689,834058,834175,902271,904660,904780,905980
+/webservices/axis2/trunk/java/modules/parent:728674,731798,732539,732541,732873,732877,732924,732927,732939,733293,733295,733304,733306,733348,733354,733394,733399,733463-733464,733533,733539-733540,733676,733776,733900,733910,734227,734237,734261,738057,738067,738071,738086,738110,738113,738117,738158,740332,740357,740360,741300,741784,741873,741878,741881,748761,751964,754458,754467,754503,757151-757153,759488,759507,759878,759968,761025,761044,761709,761770,761952,763148,765102,771051,777648,777882,777897,777934,778060,780546,783479,795431,801630,803725,805578,805981,805999,806085,806331,807160,807487,807512,816740,816804,816812,816891,817965,821686,821689,834058,834175,902271,904660,904780,905980

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/pom.xml?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/pom.xml (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/pom.xml Sat Oct 30 21:56:49 2010
@@ -70,7 +70,7 @@
         <dependency>
             <groupId>com.sun.xml.messaging.saaj</groupId>
             <artifactId>saaj-impl</artifactId>
-            <version>1.3</version>
+            <version>1.3.2</version>
             <scope>test</scope>
             <exclusions>
                 <exclusion>
@@ -79,6 +79,14 @@
                 </exclusion>
             </exclusions>
         </dependency>
+        <!-- This is required on IBM JDKs (and potentially others) because saaj-impl depends
+             on Sun's internal copy of Xerces. See AXIS2-4228. -->
+        <dependency>
+            <groupId>com.sun.xml.parsers</groupId>
+            <artifactId>jaxp-ri</artifactId>
+            <version>1.4.2</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
     <build>
         <sourceDirectory>src</sourceDirectory>
@@ -139,27 +147,12 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
+                    <includes>
+                        <include>**/*Test.java</include>
+                    </includes>
                     <forkMode>once</forkMode>
                     <argLine>-Djava.endorsed.dirs=${m2Repository}/org/apache/geronimo/specs/geronimo-saaj_1.3_spec/${geronimo.spec.saaj.version}/</argLine>
                     <systemProperties>
-                        <property>
-                            <name>javax.xml.soap.MessageFactory</name>
-                            <value>org.apache.axis2.saaj.MessageFactoryImpl</value>
-                        </property>
-                        <property>
-                            <name>javax.xml.soap.SOAPFactory</name>
-                            <value>org.apache.axis2.saaj.SOAPFactoryImpl</value>
-                        </property>
-                        <property>
-                            <name>javax.xml.soap.SOAPConnectionFactory</name>
-                            <value>org.apache.axis2.saaj.SOAPConnectionFactoryImpl</value>
-                        </property>
-                        <property>
-                            <name>javax.xml.soap.MetaFactory</name>
-                            <value>org.apache.axis2.saaj.SAAJMetaFactoryImpl</value>
-                        </property>
-                    </systemProperties>
-                    <systemProperties>
                         <!-- Prevent Mac OS X from showing an icon in the dock during the test run -->
                         <property>
                             <name>java.awt.headless</name>

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/MessageFactoryImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/MessageFactoryImpl.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/MessageFactoryImpl.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/MessageFactoryImpl.java Sat Oct 30 21:56:49 2010
@@ -77,6 +77,7 @@ import java.io.InputStream;
 public class MessageFactoryImpl extends MessageFactory {
 
     protected String soapVersion = SOAPConstants.SOAP_1_1_PROTOCOL;
+    private boolean processMTOM;
 
     /**
      * Creates a new <CODE>SOAPMessage</CODE> object with the default <CODE>SOAPPart</CODE>,
@@ -128,7 +129,7 @@ public class MessageFactoryImpl extends 
      */
     public SOAPMessage createMessage(MimeHeaders mimeheaders,
                                      InputStream inputstream) throws IOException, SOAPException {
-        SOAPMessageImpl soapMessage = new SOAPMessageImpl(inputstream, mimeheaders);
+        SOAPMessageImpl soapMessage = new SOAPMessageImpl(inputstream, mimeheaders, processMTOM);
         soapMessage.setSaveRequired();
         return soapMessage;
     }
@@ -136,4 +137,23 @@ public class MessageFactoryImpl extends 
     public void setSOAPVersion(String soapVersion) {
         this.soapVersion = soapVersion;
     }
+
+    /**
+     * Specify whether MTOM messages should be processed or parsed literally.
+     * <p>
+     * The way MTOM messages are handled fundamentally differs between Axiom and SAAJ.
+     * While Axiom replaces xop:Include elements by {@link javax.activation.DataHandler} backed
+     * {@link org.apache.axiom.om.OMText} nodes, there is no such requirement in SAAJ. The only
+     * requirement there is that {@link SOAPMessage#getAttachment(javax.xml.soap.SOAPElement)}
+     * returns the relevant {@link javax.xml.soap.AttachmentPart} when applied to an
+     * xop:Include element.
+     * <p>
+     * This method allows to make this SAAJ implementation behave as Axiom, i.e. to substitute
+     * xop:Include elements.
+     * 
+     * @param processMTOM whether xop:Include elements should be substituted
+     */
+    public void setProcessMTOM(boolean processMTOM) {
+        this.processMTOM = processMTOM;
+    }
 }

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java Sat Oct 30 21:56:49 2010
@@ -20,11 +20,12 @@
 package org.apache.axis2.saaj;
 
 import org.apache.axiom.attachments.Attachments;
+import org.apache.axiom.attachments.ConfigurableDataHandler;
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.impl.llom.OMTextImpl;
+import org.apache.axiom.om.impl.MTOMConstants;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
@@ -38,12 +39,14 @@ import org.apache.axis2.engine.Phase;
 import org.apache.axis2.saaj.util.IDGenerator;
 import org.apache.axis2.saaj.util.SAAJUtil;
 import org.apache.axis2.saaj.util.UnderstandAllHeadersHandler;
+import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.wsdl.WSDLConstants;
 
 import javax.activation.DataHandler;
 import javax.xml.namespace.QName;
 import javax.xml.soap.AttachmentPart;
 import javax.xml.soap.MessageFactory;
+import javax.xml.soap.MimeHeader;
 import javax.xml.soap.MimeHeaders;
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPConnection;
@@ -121,36 +124,53 @@ public class SOAPConnectionImpl extends 
         opClient.setOptions(options);
 
         MessageContext requestMsgCtx = new MessageContext();
-        org.apache.axiom.soap.SOAPEnvelope envelope =
-                SAAJUtil.toOMSOAPEnvelope(request.getSOAPPart().getDocumentElement());
+        org.apache.axiom.soap.SOAPEnvelope envelope;
         if (isMTOM(request)) {
-            Map<String,DataHandler> attachmentMap = new HashMap<String,DataHandler>();
-            for (Iterator it = request.getAttachments(); it.hasNext(); ) {
-                AttachmentPart attachment = (AttachmentPart)it.next();
-                String contentId = attachment.getContentId();
-                if (contentId != null) {
-                    DataHandler dh = attachment.getDataHandler();
-                    if (dh == null) {
-                        throw new SOAPException("Attachment with NULL DataHandler");
+            envelope = SAAJUtil.toOMSOAPEnvelope(request);
+            options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
+        } else {
+            envelope = SAAJUtil.toOMSOAPEnvelope(request.getSOAPPart().getDocumentElement());
+            if (request.countAttachments() != 0) { // SOAPMessage with attachments
+                Attachments attachments = requestMsgCtx.getAttachmentMap();
+                for (Iterator it = request.getAttachments(); it.hasNext(); ) {
+                    AttachmentPart attachment = (AttachmentPart)it.next();
+                    String contentId = attachment.getContentId();
+                    // Axiom currently doesn't support attachments without Content-ID
+                    // (see WSCOMMONS-418); generate one if necessary.
+                    if (contentId == null) {
+                        contentId = IDGenerator.generateID();
                     }
-                    attachmentMap.put(contentId, dh);
+                    DataHandler handler = attachment.getDataHandler();
+                    // make sure that AttachmentPart content-type overrides DataHandler content-type
+                    if (!SAAJUtil.compareContentTypes(attachment.getContentType(), handler.getContentType())) {
+                        ConfigurableDataHandler configuredHandler = new ConfigurableDataHandler(handler.getDataSource());
+                        configuredHandler.setContentType(attachment.getContentType());
+                        handler = configuredHandler;
+                    }
+                    attachments.addDataHandler(contentId, handler);
                 }
+                options.setProperty(Constants.Configuration.ENABLE_SWA, Constants.VALUE_TRUE);
             }
-            insertAttachmentNodes(attachmentMap, envelope);
-            options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
-        } else if (request.countAttachments() != 0) { // SOAPMessage with attachments
-            Attachments attachments = requestMsgCtx.getAttachmentMap();
-            for (Iterator it = request.getAttachments(); it.hasNext(); ) {
-                AttachmentPart attachment = (AttachmentPart)it.next();
-                String contentId = attachment.getContentId();
-                // Axiom currently doesn't support attachments without Content-ID
-                // (see WSCOMMONS-418); generate one if necessary.
-                if (contentId == null) {
-                    contentId = IDGenerator.generateID();
+        }
+        
+        Map<String,String> httpHeaders = null;
+        for (Iterator it = request.getMimeHeaders().getAllHeaders(); it.hasNext(); ) {
+            MimeHeader header = (MimeHeader)it.next();
+            String name = header.getName().toLowerCase();
+            if (name.equals("soapaction")) {
+                requestMsgCtx.setSoapAction(header.getValue());
+            } else if (name.equals("content-type")) {
+                // Don't set the Content-Type explicitly since it will be computed by the
+                // message builder.
+            } else {
+                if (httpHeaders == null) {
+                    httpHeaders = new HashMap<String,String>();
                 }
-                attachments.addDataHandler(contentId, attachment.getDataHandler());
+                httpHeaders.put(header.getName(), header.getValue());
             }
-            options.setProperty(Constants.Configuration.ENABLE_SWA, Constants.VALUE_TRUE);
+        }
+        if (httpHeaders != null) {
+            requestMsgCtx.setProperty(HTTPConstants.HTTP_HEADERS, httpHeaders);
         }
         
         MessageContext responseMsgCtx;
@@ -320,11 +340,13 @@ public class SOAPConnectionImpl extends 
                         final DataHandler datahandler = (DataHandler)omText.getDataHandler();
                         AttachmentPart attachment = saajSOAPMsg.createAttachmentPart(datahandler);
                         final String id = IDGenerator.generateID();
-                        attachment.setContentId(id);
+                        attachment.setContentId("<" + id + ">");
                         attachment.setContentType(datahandler.getContentType());
                         saajSOAPMsg.addAttachmentPart(attachment);
 
-                        saajEle.addAttribute(
+                        SOAPElement xopInclude = saajEle.addChildElement(MTOMConstants.XOP_INCLUDE,
+                                "xop", MTOMConstants.XOP_NAMESPACE_URI);
+                        xopInclude.addAttribute(
                                 saajSOAPMsg.getSOAPPart().getEnvelope().createName("href"),
                                 "cid:" + id);
                     } else {
@@ -355,61 +377,6 @@ public class SOAPConnectionImpl extends 
         }
     }
 
-    /**
-     * Inserts the attachments in the proper places
-     *
-     * @param attachments
-     * @param omEnvelope
-     * @throws SOAPException
-     */
-    private void insertAttachmentNodes(Map<String,DataHandler> attachments,
-                                       OMElement omEnvelope)
-            throws SOAPException {
-
-        Iterator childIter = omEnvelope.getChildElements();
-        while (childIter.hasNext()) {
-            OMElement child = (OMElement)childIter.next();
-            final OMAttribute hrefAttr = child.getAttribute(new QName("href"));
-            String contentID = getContentID(hrefAttr);
-
-            if (contentID != null) {//This is an omEnvelope referencing an attachment
-                child.build();
-                DataHandler dh = attachments.get(contentID.trim());
-                //update the key status as accessed
-                OMText text = new OMTextImpl(dh, true,
-                                             omEnvelope.getOMFactory());
-                child.removeAttribute(hrefAttr);
-                child.addChild(text);
-            } else {
-                //possibly there can be references in the children of this omEnvelope
-                //so recurse through.
-                insertAttachmentNodes(attachments, child);
-            }
-        }
-    }
-
-    /**
-     * This method checks the value of attribute and if it is a valid CID then returns the contentID
-     * (with cid: prefix stripped off) or else returns null. A null return value can be assumed that
-     * this attribute is not an attachment referencing attribute
-     *
-     * @return the ContentID
-     */
-    private String getContentID(OMAttribute attr) {
-        String contentId;
-        if (attr != null) {
-            contentId = attr.getAttributeValue();
-        } else {
-            return null;
-        }
-
-        if (contentId.startsWith("cid:")) {
-            contentId = contentId.substring(4);
-            return contentId;
-        }
-        return null;
-    }
-
     /** overrided SOAPConnection's get() method */
 
     public SOAPMessage get(Object to) throws SOAPException {
@@ -475,7 +442,7 @@ public class SOAPConnectionImpl extends 
                     httpInputStream = httpCon.getInputStream();
                 }
 
-                soapMessage = new SOAPMessageImpl(httpInputStream, mimeHeaders);
+                soapMessage = new SOAPMessageImpl(httpInputStream, mimeHeaders, false);
                 httpInputStream.close();
                 httpCon.disconnect();
 

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java Sat Oct 30 21:56:49 2010
@@ -423,16 +423,12 @@ public class SOAPElementImpl extends Nod
      * @since SAAJ 1.3
      */
     public QName createQName(String localName, String prefix) throws SOAPException {
-        if (this.element.getNamespaceURI(prefix) == null) {
+        String namespaceURI = element.getNamespaceURI(prefix);
+        if (namespaceURI == null) {
             throw new SOAPException("Invalid prefix");
+        } else {
+            return new QName(namespaceURI, localName, prefix);
         }
-        QName qname = null;
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
-            qname = new QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, localName, prefix);
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
-            qname = new QName(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, localName, prefix);
-        }
-        return qname;
     }
 
     public Iterator getAllAttributesAsQNames() {
@@ -601,14 +597,14 @@ public class SOAPElementImpl extends Nod
       * @see org.w3c.dom.Element#getElementsByTagName(java.lang.String)
       */
     public NodeList getElementsByTagName(String name) {
-        return element.getElementsByTagName(name);
+        return toSAAJNodeList(element.getElementsByTagName(name));
     }
 
     /* (non-Javadoc)
       * @see org.w3c.dom.Element#getElementsByTagNameNS(java.lang.String, java.lang.String)
       */
     public NodeList getElementsByTagNameNS(String namespaceURI, String localName) {
-        return element.getElementsByTagNameNS(namespaceURI, localName);
+        return toSAAJNodeList(element.getElementsByTagNameNS(namespaceURI, localName));
     }
 
     /* (non-Javadoc)
@@ -754,6 +750,15 @@ public class SOAPElementImpl extends Nod
         return null;
     }
 
+    public String getTextContent() throws DOMException {
+        return element.getTextContent();
+    }
+
+    @Override
+    protected Object clone() throws CloneNotSupportedException {
+        // TODO Auto-generated method stub
+        return super.clone();
+    }
 
     public org.w3c.dom.Node getFirstChild() {
         return toSAAJNode(element.getFirstChild());
@@ -790,14 +795,16 @@ public class SOAPElementImpl extends Nod
         return toSAAJNode(element.getPreviousSibling());
     }
 
-    public NodeList getChildNodes() {
-        NodeList childNodes = element.getChildNodes();
-        NodeListImpl nodes = new NodeListImpl();
-
-        for (int i = 0; i < childNodes.getLength(); i++) {
-            nodes.addNode(toSAAJNode(childNodes.item(i)));
+    private NodeList toSAAJNodeList(NodeList nodes) {
+        NodeListImpl result = new NodeListImpl();
+        for (int i = 0; i < nodes.getLength(); i++) {
+            result.addNode(toSAAJNode(nodes.item(i)));
         }
-        return nodes;
+        return result;
+    }
+
+    public NodeList getChildNodes() {
+        return toSAAJNodeList(element.getChildNodes());
     }
 
     public boolean hasChildNodes() {

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java Sat Oct 30 21:56:49 2010
@@ -19,7 +19,9 @@
 
 package org.apache.axis2.saaj;
 
+import org.apache.axiom.attachments.Attachments;
 import org.apache.axiom.attachments.ByteArrayDataSource;
+import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.impl.MIMEOutputUtils;
 import org.apache.axiom.soap.SOAP11Constants;
@@ -72,7 +74,7 @@ public class SOAPMessageImpl extends SOA
         soapPart = new SOAPPartImpl(this, soapEnvelope);
     }
 
-    public SOAPMessageImpl(InputStream inputstream, javax.xml.soap.MimeHeaders mimeHeaders)
+    public SOAPMessageImpl(InputStream inputstream, MimeHeaders mimeHeaders, boolean processMTOM)
             throws SOAPException {
         String contentType = null;
         String tmpContentType = "";
@@ -83,11 +85,37 @@ public class SOAPMessageImpl extends SOA
                 contentType = SAAJUtil.normalizeContentType(tmpContentType);
             }
         }
-        initCharsetEncodingFromContentType(tmpContentType);
-        if (contentType != null) {
-            soapPart = new SOAPPartImpl(this, inputstream, mimeHeaders);
+        if ("multipart/related".equals(contentType)) {
+            try {
+                Attachments attachments =
+                        new Attachments(inputstream, tmpContentType, false, "", "");
+                
+                // Axiom doesn't give us access to the MIME headers of the individual
+                // parts of the SOAP message package. We need to reconstruct them from
+                // the available information.
+                MimeHeaders soapPartHeaders = new MimeHeaders();
+                soapPartHeaders.addHeader(HTTPConstants.CONTENT_TYPE,
+                        attachments.getSOAPPartContentType());
+                String soapPartContentId = attachments.getSOAPPartContentID();
+                soapPartHeaders.addHeader("Content-ID", "<" + soapPartContentId + ">");
+                
+                soapPart = new SOAPPartImpl(this, attachments.getSOAPPartInputStream(),
+                        soapPartHeaders, processMTOM ? attachments : null);
+                
+                for (String contentId : attachments.getAllContentIDs()) {
+                    if (!contentId.equals(soapPartContentId)) {
+                        AttachmentPart ap =
+                                createAttachmentPart(attachments.getDataHandler(contentId));
+                        ap.setContentId("<" + contentId + ">");
+                        attachmentParts.add(ap);
+                    }
+                }
+            } catch (OMException e) {
+                throw new SOAPException(e);
+            }
         } else {
-            soapPart = new SOAPPartImpl(this, inputstream);
+            initCharsetEncodingFromContentType(tmpContentType);
+            soapPart = new SOAPPartImpl(this, inputstream, mimeHeaders, null);
         }
 
         this.mimeHeaders = (mimeHeaders == null) ?

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java Sat Oct 30 21:56:49 2010
@@ -29,7 +29,6 @@ import org.apache.axiom.soap.impl.builde
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
 import org.apache.axiom.soap.impl.dom.soap12.SOAP12Factory;
-import org.apache.axis2.builder.BuilderUtil;
 import org.apache.axis2.saaj.util.IDGenerator;
 import org.apache.axis2.saaj.util.SAAJUtil;
 import org.apache.axis2.transport.http.HTTPConstants;
@@ -53,6 +52,8 @@ import org.w3c.dom.ProcessingInstruction
 import org.w3c.dom.Text;
 import org.w3c.dom.UserDataHandler;
 
+import javax.mail.internet.ContentType;
+import javax.mail.internet.ParseException;
 import javax.xml.soap.MimeHeaders;
 import javax.xml.soap.SOAPElement;
 import javax.xml.soap.SOAPEnvelope;
@@ -95,11 +96,26 @@ public class SOAPPartImpl extends SOAPPa
         envelope.setSOAPPartParent(this);
     }
 
-    public SOAPPartImpl(SOAPMessageImpl parentSoapMsg,
-                        InputStream inputStream, javax.xml.soap.MimeHeaders mimeHeaders
-    ) throws SOAPException {
-        String contentType = "";
-        String fullContentTypeStr = "";
+    /**
+     * Construct a SOAP part from the given input stream.
+     * The content type (as provided by the MIME headers) must be SOAP 1.1, SOAP 1.2
+     * or XOP (MTOM). MIME packages (multipart/related) are not supported and should be
+     * parsed using {@link SOAPMessageImpl#SOAPMessageImpl(InputStream, MimeHeaders).
+     * <p>
+     * If the content type is XOP, xop:Include elements will only be replaced if
+     * the <code>attachments</code> parameter is not null.
+     *
+     * @see MessageFactoryImpl#setProcessMTOM(boolean)
+     * 
+     * @param parentSoapMsg the parent SOAP message
+     * @param inputStream the input stream with the content of the SOAP part
+     * @param mimeHeaders the MIME headers
+     * @param attachments the set of attachments to be used to substitute xop:Include elements
+     * @throws SOAPException
+     */
+    public SOAPPartImpl(SOAPMessageImpl parentSoapMsg, InputStream inputStream,
+                        MimeHeaders mimeHeaders, Attachments attachments) throws SOAPException {
+        ContentType contentType = null;
         if (mimeHeaders == null) {
             //TODO : read string from constants
             this.mimeHeaders = new MimeHeaders();
@@ -108,93 +124,78 @@ public class SOAPPartImpl extends SOAPPa
         } else {
             String contentTypes[] = mimeHeaders.getHeader(HTTPConstants.CONTENT_TYPE);
             if (contentTypes != null && contentTypes.length > 0) {
-                fullContentTypeStr = contentTypes[0];
-                contentType = SAAJUtil.normalizeContentType(fullContentTypeStr);
+                try {
+                    contentType = new ContentType(contentTypes[0]);
+                } catch (ParseException ex) {
+                    throw new SOAPException("Invalid content type '" + contentTypes[0] + "'");
+                }
             }
             this.mimeHeaders = SAAJUtil.copyMimeHeaders(mimeHeaders);
         }
 
         soapMessage = parentSoapMsg;
 
-        String knownEncoding = (String) soapMessage.getProperty(SOAPMessage.CHARACTER_SET_ENCODING);
-        XMLStreamReader xmlReader = null;
-      
-        
-        StAXSOAPModelBuilder builder = null;
-
-        if (contentType.indexOf("multipart/related") == 0) {
-            //This contains attachements
-            try {
-                Attachments attachments =
-                        new Attachments(inputStream, fullContentTypeStr, false, "", "");
-
-                String soapEnvelopeNamespaceURI =
-                        BuilderUtil.getEnvelopeNamespace(fullContentTypeStr);
-
-                String charSetEncoding =
-                        BuilderUtil.getCharSetEncoding(attachments.getSOAPPartContentType());
-
-                XMLStreamReader streamReader =
-                        StAXUtils.createXMLStreamReader(BuilderUtil.getReader(
-                                attachments.getSOAPPartInputStream(), charSetEncoding));
-
-                SOAPFactory factory;
-                if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapEnvelopeNamespaceURI)) {
-                    factory = new SOAP11Factory();
-                } else {
-                    factory = new SOAP12Factory();
-                }
-                if (attachments.getAttachmentSpecType().equals(
-                        MTOMConstants.MTOM_TYPE)) {
-                    //Creates the MTOM specific MTOMStAXSOAPModelBuilder
-                    builder = new MTOMStAXSOAPModelBuilder(streamReader,
-                                                           factory,
-                                                           attachments,
-                                                           soapEnvelopeNamespaceURI);
-                } else if (attachments.getAttachmentSpecType().equals(
-                        MTOMConstants.SWA_TYPE)) {
-                    builder = new StAXSOAPModelBuilder(streamReader,
-                                                       factory,
-                                                       soapEnvelopeNamespaceURI);
-                } else if (attachments.getAttachmentSpecType().equals(
-                        MTOMConstants.SWA_TYPE_12)) {
-                    builder = new StAXSOAPModelBuilder(streamReader,
-                                                       factory,
-                                                       soapEnvelopeNamespaceURI);
-                }
-
-            } catch (Exception e) {
-                throw new SOAPException(e);
-            }
+        String charset;
+        boolean isMTOM;
+        String soapEnvelopeNamespaceURI;
+        SOAPFactory soapFactory;
+        if (contentType == null) {
+            charset = null;
+            isMTOM = false;
+            soapFactory = new SOAP11Factory();
+            soapEnvelopeNamespaceURI = null;
         } else {
-            try {
-                XMLStreamReader streamReader = null;
-                
-                if(knownEncoding != null){
-                	streamReader = StAXUtils.createXMLStreamReader(inputStream, knownEncoding);
-                }else{
-                	streamReader = StAXUtils.createXMLStreamReader(inputStream);                	
-                }
-
-                if (HTTPConstants.MEDIA_TYPE_TEXT_XML.equals(contentType)) {
-                    builder = new StAXSOAPModelBuilder(streamReader,
-                                                       new SOAP11Factory(),
-                                                       SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-
-                } else if (HTTPConstants.MEDIA_TYPE_APPLICATION_SOAP_XML.equals(contentType)) {
-                    builder = new StAXSOAPModelBuilder(streamReader,
-                                                       new SOAP12Factory(),
-                                                       SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-
+            String baseType = contentType.getBaseType().toLowerCase();
+            String soapContentType;
+            if (baseType.equals(MTOMConstants.MTOM_TYPE)) {
+                isMTOM = true;
+                String typeParam = contentType.getParameter("type");
+                if (typeParam == null) {
+                    throw new SOAPException("Missing 'type' parameter in XOP content type");
                 } else {
-                    builder = new StAXSOAPModelBuilder(streamReader,
-                                                       new SOAP11Factory(),
-                                                       null);
+                    soapContentType = typeParam.toLowerCase();
                 }
-            } catch (XMLStreamException e) {
-                throw new SOAPException(e);
+            } else {
+                isMTOM = false;
+                soapContentType = baseType;
             }
+            
+            if (soapContentType.equals(HTTPConstants.MEDIA_TYPE_TEXT_XML)) {
+                soapEnvelopeNamespaceURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+                soapFactory = new SOAP11Factory();
+            } else if (soapContentType.equals(HTTPConstants.MEDIA_TYPE_APPLICATION_SOAP_XML)) {
+                soapEnvelopeNamespaceURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+                soapFactory = new SOAP12Factory();
+            } else {
+                throw new SOAPException("Unrecognized content type '" + soapContentType + "'");
+            }
+            
+            charset = contentType.getParameter("charset");
+        }
+        
+        XMLStreamReader streamReader;
+        try {
+            if (charset != null) {
+            	streamReader = StAXUtils.createXMLStreamReader(inputStream, charset);
+            } else {
+            	streamReader = StAXUtils.createXMLStreamReader(inputStream);                	
+            }
+        } catch (XMLStreamException e) {
+            throw new SOAPException(e);
         }
+
+        StAXSOAPModelBuilder builder;
+        if (isMTOM && attachments != null) {
+            builder = new MTOMStAXSOAPModelBuilder(streamReader,
+                                                   soapFactory,
+                                                   attachments,
+                                                   soapEnvelopeNamespaceURI);
+        } else {
+            builder = new StAXSOAPModelBuilder(streamReader,
+                                               soapFactory,
+                                               soapEnvelopeNamespaceURI);
+        }
+        
         try {
             org.apache.axiom.soap.SOAPEnvelope soapEnvelope = builder.getSOAPEnvelope();
             envelope = new SOAPEnvelopeImpl(
@@ -207,11 +208,6 @@ public class SOAPPartImpl extends SOAPPa
         }
     }
 
-    public SOAPPartImpl(SOAPMessageImpl parentSoapMsg,
-                        InputStream inputStream) throws SOAPException {
-        this(parentSoapMsg, inputStream, null);
-    }
-
     /**
      * Obtain the SOAPMessage
      *

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/util/SAAJUtil.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/util/SAAJUtil.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/util/SAAJUtil.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/src/org/apache/axis2/saaj/util/SAAJUtil.java Sat Oct 30 21:56:49 2010
@@ -19,19 +19,24 @@
 
 package org.apache.axis2.saaj.util;
 
+import org.apache.axiom.attachments.Attachments;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.impl.dom.DOOMAbstractFactory;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder;
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import javax.activation.DataHandler;
 import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.soap.AttachmentPart;
 import javax.xml.soap.MimeHeader;
 import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPException;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -118,6 +123,37 @@ public class SAAJUtil {
                 new StAXSOAPModelBuilder(docElem.getXMLStreamReader(), null);
         return stAXSOAPModelBuilder.getSOAPEnvelope();
     }
+    
+    /**
+     * Convert a SAAJ message to an Axiom SOAP envelope object and process xop:Include
+     * elements.
+     * 
+     * @param message the SAAJ message
+     * @return the OM SOAP envelope
+     * @throws SOAPException
+     */
+    public static org.apache.axiom.soap.SOAPEnvelope toOMSOAPEnvelope(
+            javax.xml.soap.SOAPMessage message) throws SOAPException {
+        
+        Attachments attachments = new Attachments();
+        for (Iterator it = message.getAttachments(); it.hasNext(); ) {
+            AttachmentPart attachment = (AttachmentPart)it.next();
+            String contentId = attachment.getContentId();
+            if (contentId != null) {
+                DataHandler dh = attachment.getDataHandler();
+                if (dh == null) {
+                    throw new SOAPException("Attachment with NULL DataHandler");
+                }
+                if (contentId.startsWith("<") && contentId.endsWith(">")) {
+                    contentId = contentId.substring(1, contentId.length()-1);
+                }
+                attachments.addDataHandler(contentId, dh);
+            }
+        }
+        OMElement docElem = (OMElement)message.getSOAPPart().getDocumentElement();
+        MTOMStAXSOAPModelBuilder builder = new MTOMStAXSOAPModelBuilder(docElem.getXMLStreamReader(), attachments);
+        return builder.getSOAPEnvelope();
+    }
 
     /**
      * Convert a given OMElement to a DOM Element
@@ -163,4 +199,10 @@ public class SAAJUtil {
         int idx = contentType.indexOf(";");
         return (idx == -1 ? contentType : contentType.substring(0, idx)).trim().toLowerCase();
     }
+    
+    public static boolean compareContentTypes(String contentType1, String contentType2) {
+        String ct1 = (contentType1 == null) ? "" : contentType1.trim().toLowerCase();
+        String ct2 = (contentType2 == null) ? "" : contentType2.trim().toLowerCase();
+        return ct1.equals(ct2);        
+    }
 }

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/test-resources/message.bin
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test-resources/message.bin?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test-resources/message.bin (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test-resources/message.bin Sat Oct 30 21:56:49 2010
@@ -1,5 +1,5 @@
 --MIMEBoundaryurn:uuid:F02ECC18873CFB73E211412748909307
-content-type: application/xop+xml; charset=UTF-8; type="text/xml";
+content-type: application/xop+xml; charset=UTF-8; type="text/xml"
 content-transfer-encoding: binary
 content-id: <0....@apache.org>
 

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/AttachmentSerializationTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/AttachmentSerializationTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/AttachmentSerializationTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/AttachmentSerializationTest.java Sat Oct 30 21:56:49 2010
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 
 import javax.activation.DataHandler;
 import javax.activation.FileDataSource;
@@ -32,6 +32,10 @@ import javax.xml.soap.SOAPEnvelope;
 import javax.xml.soap.SOAPHeader;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -40,17 +44,15 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.Iterator;
 
-public class AttachmentSerializationTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class AttachmentSerializationTest extends Assert {
 
     public static final String MIME_MULTIPART_RELATED = "multipart/related";
     public static final String MIME_APPLICATION_DIME = "application/dime";
     public static final String NS_PREFIX = "jaxmtst";
     public static final String NS_URI = "http://www.jcommerce.net/soap/jaxm/TestJaxm";
 
-    public AttachmentSerializationTest(String name) {
-        super(name);
-    }
-
+    @Validated @Test
     public void testAttachments() throws Exception {
         try {
             ByteArrayOutputStream bais = new ByteArrayOutputStream();
@@ -98,6 +100,8 @@ public class AttachmentSerializationTest
         ap2.setContentType("image/jpg");
         msg.addAttachmentPart(ap2);
 
+        msg.saveChanges(); // This is only required with Sun's SAAJ implementation
+
         MimeHeaders headers = msg.getMimeHeaders();
         assertTrue(headers != null);
         String [] contentType = headers.getHeader("Content-Type");

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java Sat Oct 30 21:56:49 2010
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 import org.apache.axiom.attachments.utils.IOUtils;
 import org.apache.axiom.om.util.Base64;
 import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
@@ -28,12 +28,16 @@ import org.apache.commons.httpclient.Htt
 import org.apache.commons.httpclient.HttpStatus;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.params.HttpMethodParams;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import javax.activation.DataHandler;
 import javax.activation.DataSource;
+import javax.imageio.ImageIO;
 import javax.xml.soap.AttachmentPart;
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.transform.stream.StreamSource;
@@ -48,13 +52,9 @@ import java.io.OutputStream;
 import java.net.URL;
 import java.util.Iterator;
 
-public class AttachmentTest extends TestCase {
-
-    public AttachmentTest(String name) {
-        super(name);
-    }
-
-
+@RunWith(SAAJTestRunner.class)
+public class AttachmentTest extends Assert {
+    @Validated @Test
     public void testStringAttachment() throws Exception {
 
         MessageFactory factory = MessageFactory.newInstance();
@@ -69,7 +69,7 @@ public class AttachmentTest extends Test
 
         assertTrue(message.countAttachments() == 1);
 
-        java.util.Iterator it = message.getAttachments();
+        Iterator it = message.getAttachments();
         while (it.hasNext()) {
             attachment = (AttachmentPart)it.next();
             Object content = attachment.getContent();
@@ -80,63 +80,29 @@ public class AttachmentTest extends Test
         assertTrue(message.countAttachments() == 0);
     }
 
-
+    @Validated @Test
     public void testMultipleAttachments() throws Exception {
 
         MessageFactory factory = MessageFactory.newInstance();
         SOAPMessage msg = factory.createMessage();
-        java.net.URL url1 = new java.net.URL("http://www.apache.org/licenses/LICENSE-2.0.html");
-        java.net.URL url2 = new java.net.URL("http://www.apache.org/licenses/LICENSE-2.0.txt");
-
-        AttachmentPart a1 = msg.createAttachmentPart(new javax.activation.DataHandler(url1));
-        a1.setContentType("text/xml");
-        msg.addAttachmentPart(a1);
-        AttachmentPart a2 = msg.createAttachmentPart(new javax.activation.DataHandler(url1));
-        a2.setContentType("text/xml");
-        msg.addAttachmentPart(a2);
-        AttachmentPart a3 = msg.createAttachmentPart(new javax.activation.DataHandler(url2));
-        a3.setContentType("text/plain");
-        msg.addAttachmentPart(a3);
-
-        assertTrue(msg.countAttachments() == 3);
-
-        javax.xml.soap.MimeHeaders mimeHeaders = new javax.xml.soap.MimeHeaders();
-        mimeHeaders.addHeader("Content-Type", "text/xml");
-
-        int nAttachments = 0;
-        java.util.Iterator iterator = msg.getAttachments(mimeHeaders);
-        while (iterator.hasNext()) {
-            nAttachments++;
-            AttachmentPart ap = (AttachmentPart)iterator.next();
-            assertTrue(ap.equals(a1) || ap.equals(a2));
-        }
-        assertTrue(nAttachments == 2);
-    }
-
-
-    public void testMultipleAttachments2() throws Exception {
-        MessageFactory factory = MessageFactory.newInstance();
-        SOAPMessage msg = factory.createMessage();
-        java.net.URL url1 = new java.net.URL("http://www.apache.org/licenses/LICENSE-2.0.html");
-        java.net.URL url2 = new java.net.URL("http://www.apache.org/licenses/LICENSE-2.0.txt");
 
-        AttachmentPart a1 = msg.createAttachmentPart(new javax.activation.DataHandler(url1));
+        AttachmentPart a1 = msg.createAttachmentPart(new DataHandler("<some_xml/>", "text/xml"));
         a1.setContentType("text/xml");
         msg.addAttachmentPart(a1);
-        AttachmentPart a2 = msg.createAttachmentPart(new javax.activation.DataHandler(url1));
+        AttachmentPart a2 = msg.createAttachmentPart(new DataHandler("<some_xml/>", "text/xml"));
         a2.setContentType("text/xml");
         msg.addAttachmentPart(a2);
-        AttachmentPart a3 = msg.createAttachmentPart(new javax.activation.DataHandler(url2));
+        AttachmentPart a3 = msg.createAttachmentPart(new DataHandler("text", "text/plain"));
         a3.setContentType("text/plain");
         msg.addAttachmentPart(a3);
 
         assertTrue(msg.countAttachments() == 3);
 
-        javax.xml.soap.MimeHeaders mimeHeaders = new javax.xml.soap.MimeHeaders();
+        MimeHeaders mimeHeaders = new MimeHeaders();
         mimeHeaders.addHeader("Content-Type", "text/xml");
 
         int nAttachments = 0;
-        java.util.Iterator iterator = msg.getAttachments(mimeHeaders);
+        Iterator iterator = msg.getAttachments(mimeHeaders);
         while (iterator.hasNext()) {
             nAttachments++;
             AttachmentPart ap = (AttachmentPart)iterator.next();
@@ -145,6 +111,9 @@ public class AttachmentTest extends Test
         assertTrue(nAttachments == 2);
     }
 
+    // Note: This test case fails with Sun's SAAJ implementation
+    //       and can't be @Validated.
+    @Test
     public void testBadAttSize() throws Exception {
         MessageFactory factory = MessageFactory.newInstance();
         SOAPMessage message = factory.createMessage();
@@ -182,7 +151,7 @@ public class AttachmentTest extends Test
         }
     }
 
-
+    @Validated @Test
     public void testClearContent() throws Exception {
         try {
             InputStream in1 = new FileInputStream(new File(System.getProperty("basedir", ".") +
@@ -260,13 +229,13 @@ public class AttachmentTest extends Test
 
     }
 
-
+    @Validated @Test
     public void testGetContent() throws Exception {
         try {
             MessageFactory factory = MessageFactory.newInstance();
             SOAPMessage msg = factory.createMessage();
             AttachmentPart ap = msg.createAttachmentPart();
-            Image image = javax.imageio.ImageIO.read(new File(System.getProperty("basedir", ".") +
+            Image image = ImageIO.read(new File(System.getProperty("basedir", ".") +
                     "/test-resources" + File.separator + "attach.gif"));
             ap = msg.createAttachmentPart(image, "image/gif");
 
@@ -284,6 +253,7 @@ public class AttachmentTest extends Test
         }
     }
 
+    @Validated @Test
     public void testGetRawContents() {
         try {
             MessageFactory factory = MessageFactory.newInstance();
@@ -302,7 +272,7 @@ public class AttachmentTest extends Test
         }
     }
 
-
+    @Validated @Test
     public void testSetBase64Content() {
         try {
             MessageFactory factory = MessageFactory.newInstance();

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/MessageFactoryTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/MessageFactoryTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/MessageFactoryTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/MessageFactoryTest.java Sat Oct 30 21:56:49 2010
@@ -19,11 +19,16 @@
 
 package org.apache.axis2.saaj;
 
-import org.custommonkey.xmlunit.XMLTestCase;
+import org.custommonkey.xmlunit.XMLAssert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.w3c.dom.Node;
 
 import javax.xml.soap.AttachmentPart;
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPElement;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
 
@@ -36,13 +41,16 @@ import java.util.Iterator;
 /**
  * 
  */
-public class MessageFactoryTest extends XMLTestCase {
+@RunWith(SAAJTestRunner.class)
+public class MessageFactoryTest extends XMLAssert {
     private MessageFactory mf = null;
 
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         mf = MessageFactory.newInstance();
     }
 
+    @Validated @Test
     public void testCreateMessage() {
         try {
             ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
@@ -71,6 +79,7 @@ public class MessageFactoryTest extends 
         }
     }
 
+    @Validated @Test
     public void testCreateMessage2() {
         try {
             ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
@@ -116,7 +125,7 @@ public class MessageFactoryTest extends 
         }
     }
 
-
+    @Validated @Test
     public void testNewInstane() {
         try {
             MessageFactory mf = MessageFactory.newInstance();
@@ -134,59 +143,54 @@ public class MessageFactoryTest extends 
         }
     }
 
-    // Unit tests for (unresolved) issue AXIS2-4189
-/*    
+    @Validated @Test
     public void testParseMTOMMessage() throws Exception {
-        SAAJTestUtil.execute(new SAAJTestUtil.Test() {
-            public void execute(MessageFactory mf) throws Exception {
-                MimeHeaders headers = new MimeHeaders();
-                headers.addHeader("Content-Type",
-                        "multipart/related; " +
-                        "boundary=\"MIMEBoundaryurn:uuid:F02ECC18873CFB73E211412748909307\"; " +
-                        "type=\"application/xop+xml\"; " +
-                        "start=\"<0....@apache.org>\"; " +
-                        "start-info=\"text/xml\"; " +
-                        "charset=UTF-8;" +
-                        "action=\"mtomSample\"");
-                InputStream in = new FileInputStream(System.getProperty("basedir", ".")
-                        + "/test-resources/message.bin");
-                SOAPMessage message = mf.createMessage(headers, in);
-                SOAPPart soapPart = message.getSOAPPart();
-                assertEquals("<0....@apache.org>",
-                        soapPart.getContentId());
-                Iterator attachments = message.getAttachments();
-                assertTrue(attachments.hasNext());
-                AttachmentPart ap = (AttachmentPart)attachments.next();
-                assertEquals("<1....@apache.org>",
-                        ap.getContentId());
-                assertFalse(attachments.hasNext());
-            }
-        });
+        MimeHeaders headers = new MimeHeaders();
+        headers.addHeader("Content-Type", TestConstants.MTOM_TEST_MESSAGE_CONTENT_TYPE);
+        InputStream in = new FileInputStream(TestConstants.MTOM_TEST_MESSAGE_FILE);
+        SOAPMessage message = mf.createMessage(headers, in);
+        SOAPPart soapPart = message.getSOAPPart();
+        assertEquals("<0....@apache.org>",
+                soapPart.getContentId());
+        
+        // Check the xop:Include element. Note that SAAJ doesn't resolve xop:Includes!
+        SOAPElement textElement =
+                (SOAPElement)soapPart.getEnvelope().getElementsByTagName("text").item(0);
+        assertNotNull(textElement);
+        Node xopIncludeNode = textElement.getChildNodes().item(0);
+        assertTrue(xopIncludeNode instanceof SOAPElement);
+        AttachmentPart ap = message.getAttachment((SOAPElement)xopIncludeNode);
+        assertEquals("<1....@apache.org>",
+                ap.getContentId());
+        
+        // Now check the attachments
+        Iterator attachments = message.getAttachments();
+        assertTrue(attachments.hasNext());
+        ap = (AttachmentPart)attachments.next();
+        assertEquals("<1....@apache.org>",
+                ap.getContentId());
+        assertFalse(attachments.hasNext());
     }
 
+    @Validated @Test
     public void testParseSwAMessage() throws Exception {
-        SAAJTestUtil.execute(new SAAJTestUtil.Test() {
-            public void execute(MessageFactory mf) throws Exception {
-                MimeHeaders headers = new MimeHeaders();
-                headers.addHeader("Content-Type",
-                        "multipart/related; " +
-                        "boundary=MIMEBoundaryurn_uuid_E3F7CE4554928DA89B1231365678616; " +
-                        "type=\"text/xml\"; " +
-                        "start=\"<0....@apache.org>\"");
-                InputStream in = new FileInputStream(System.getProperty("basedir", ".")
-                        + "/test-resources/SwAmessage.bin");
-                SOAPMessage message = mf.createMessage(headers, in);
-                SOAPPart soapPart = message.getSOAPPart();
-                assertEquals("<0....@apache.org>",
-                        soapPart.getContentId());
-                Iterator attachments = message.getAttachments();
-                assertTrue(attachments.hasNext());
-                AttachmentPart ap = (AttachmentPart)attachments.next();
-                assertEquals("<urn:uuid:E3F7CE4554928DA89B1231365678347>",
-                        ap.getContentId());
-                assertFalse(attachments.hasNext());
-            }
-        });
+        MimeHeaders headers = new MimeHeaders();
+        headers.addHeader("Content-Type",
+                "multipart/related; " +
+                "boundary=MIMEBoundaryurn_uuid_E3F7CE4554928DA89B1231365678616; " +
+                "type=\"text/xml\"; " +
+                "start=\"<0....@apache.org>\"");
+        InputStream in = new FileInputStream(System.getProperty("basedir", ".")
+                + "/test-resources/SwAmessage.bin");
+        SOAPMessage message = mf.createMessage(headers, in);
+        SOAPPart soapPart = message.getSOAPPart();
+        assertEquals("<0....@apache.org>",
+                soapPart.getContentId());
+        Iterator attachments = message.getAttachments();
+        assertTrue(attachments.hasNext());
+        AttachmentPart ap = (AttachmentPart)attachments.next();
+        assertEquals("<urn:uuid:E3F7CE4554928DA89B1231365678347>",
+                ap.getContentId());
+        assertFalse(attachments.hasNext());
     }
-*/
 }

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/NodeTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/NodeTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/NodeTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/NodeTest.java Sat Oct 30 21:56:49 2010
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.SOAPBody;
@@ -29,12 +29,18 @@ import javax.xml.soap.SOAPHeader;
 import javax.xml.soap.SOAPHeaderElement;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.util.Iterator;
 
 /**
  * 
  */
-public class NodeTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class NodeTest extends Assert {
     private SOAPMessage msg = null;
     private SOAPPart sp = null;
     private SOAPBody body = null;
@@ -42,7 +48,8 @@ public class NodeTest extends TestCase {
     private SOAPHeader header = null;
     private SOAPHeaderElement headerEle = null;
 
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         msg = MessageFactory.newInstance().createMessage();
         sp = msg.getSOAPPart();
         envelope = sp.getEnvelope();
@@ -52,6 +59,7 @@ public class NodeTest extends TestCase {
         headerEle.setActor("actor-URI");
     }
 
+    @Validated @Test
     public void testDetachNode() {
         try {
             headerEle.detachNode();
@@ -62,6 +70,7 @@ public class NodeTest extends TestCase {
         }
     }
 
+    @Validated @Test
     public void testParentElement() {
         try {
             headerEle.detachNode();
@@ -72,6 +81,7 @@ public class NodeTest extends TestCase {
         }
     }
 
+    @Validated @Test
     public void testSetParentElement1() {
         try {
             headerEle.detachNode();
@@ -86,6 +96,8 @@ public class NodeTest extends TestCase {
         }
     }
 
+    // TODO: test fails with Sun's SAAJ implementation
+    @Test
     public void testSetParentElement2() {
         try {
             try {
@@ -99,6 +111,7 @@ public class NodeTest extends TestCase {
         }
     }
 
+    @Validated @Test
     public void testSetValue() {
         try {
             headerEle.addTextNode("foo-bar");

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/PrefixesTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/PrefixesTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/PrefixesTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/PrefixesTest.java Sat Oct 30 21:56:49 2010
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.MimeHeaders;
@@ -31,16 +31,17 @@ import javax.xml.soap.SOAPHeader;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
 import javax.xml.soap.Text;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.util.Iterator;
 
-public class PrefixesTest extends TestCase {
-
-    public PrefixesTest(String name) {
-        super(name);
-    }
-
+@RunWith(SAAJTestRunner.class)
+public class PrefixesTest extends Assert {
+    @Validated @Test
     public void testAddingPrefixesForChildElements() throws Exception {
         MessageFactory factory = MessageFactory.newInstance();
         SOAPMessage msg = factory.createMessage();
@@ -64,6 +65,7 @@ public class PrefixesTest extends TestCa
         assertTrue(xml.indexOf("http://www.apache.org") != -1);
     }
 
+    @Validated @Test
     public void testAttribute() throws Exception {
         String soappacket =
                 "<soapenv:Envelope xmlns:soapenv =\"http://schemas.xmlsoap.org/soap/envelope/\"\n" +
@@ -106,6 +108,7 @@ public class PrefixesTest extends TestCa
         }
     }
 
+    @Validated @Test
     public void testAttrPrifix() {
         try {
             MessageFactory fac = MessageFactory.newInstance();

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SAAJDetailTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SAAJDetailTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SAAJDetailTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SAAJDetailTest.java Sat Oct 30 21:56:49 2010
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 
 import javax.xml.namespace.QName;
 import javax.xml.soap.Detail;
@@ -34,10 +34,15 @@ import javax.xml.soap.SOAPHeaderElement;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
 
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 /**
  * 
  */
-public class SAAJDetailTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class SAAJDetailTest extends Assert {
     private SOAPMessage msg = null;
     private SOAPPart sp = null;
     private SOAPBody body = null;
@@ -45,7 +50,8 @@ public class SAAJDetailTest extends Test
     private SOAPHeader header = null;
     private SOAPHeaderElement headerEle = null;
 
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         msg = MessageFactory.newInstance().createMessage();
         sp = msg.getSOAPPart();
         envelope = sp.getEnvelope();
@@ -59,6 +65,7 @@ public class SAAJDetailTest extends Test
     /*
     * for soap version 1.1
     */
+    @Validated @Test
     public void testAddDetailEntry() throws Exception {
         //Add a SOAPFault object to the SOAPBody
         SOAPFault sf = body.addFault();
@@ -75,6 +82,7 @@ public class SAAJDetailTest extends Test
     /*
      * for soap version 1.2
      */
+    @Validated @Test
     public void testAddDetailEntry2() throws Exception {
         msg = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
         sp = msg.getSOAPPart();

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SAAJResultTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SAAJResultTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SAAJResultTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SAAJResultTest.java Sat Oct 30 21:56:49 2010
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.Node;
@@ -31,10 +31,15 @@ import javax.xml.soap.SOAPHeaderElement;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
 
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 /**
  * 
  */
-public class SAAJResultTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class SAAJResultTest extends Assert {
     private SOAPMessage msg = null;
     private SOAPPart sp = null;
     private SOAPBody body = null;
@@ -42,7 +47,8 @@ public class SAAJResultTest extends Test
     private SOAPHeader header = null;
     private SOAPHeaderElement headerEle = null;
 
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         msg = MessageFactory.newInstance().createMessage();
         sp = msg.getSOAPPart();
         envelope = sp.getEnvelope();
@@ -60,6 +66,7 @@ public class SAAJResultTest extends Test
     }
     */
 
+    @Validated @Test
     public void testGetResultSOAPMessage() throws Exception{
     	SAAJResult sr = new SAAJResult(msg);
     	Node node = sr.getResult();

Copied: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SAAJTestRunner.java (from r733910, webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJTestRunner.java)
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SAAJTestRunner.java?p2=axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SAAJTestRunner.java&p1=webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJTestRunner.java&r1=733910&r2=1029210&rev=1029210&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJTestRunner.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SAAJTestRunner.java Sat Oct 30 21:56:49 2010
@@ -106,15 +106,18 @@ public class SAAJTestRunner extends JUni
         if (validate) {
             multiRunListener.setFailureMessage(
                     "Invalid test case; execution failed with SAAJ reference implementation");
+
             System.setProperty("javax.xml.soap.MessageFactory",
-                    "com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl");
+            		"com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl");
             System.setProperty("javax.xml.soap.SOAPFactory",
-                    "com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl");
+            		"com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl");
             System.setProperty("javax.xml.soap.SOAPConnectionFactory",
-                    "com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnectionFactory");
+            		"com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnectionFactory");
             System.setProperty("javax.xml.soap.MetaFactory",
-                    "com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl");
+            		"com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl");
+
             resetSAAJFactories();
+
             super.invokeTestMethod(method, multiRunNotifier);
         }
         if (multiRunListener.isShouldContinue()) {

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPBodyTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPBodyTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPBodyTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPBodyTest.java Sat Oct 30 21:56:49 2010
@@ -19,7 +19,10 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -42,7 +45,8 @@ import javax.xml.soap.Text;
 import java.io.File;
 import java.util.Iterator;
 
-public class SOAPBodyTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class SOAPBodyTest extends Assert {
 
     /**
      * Method suite
@@ -55,25 +59,17 @@ public class SOAPBodyTest extends TestCa
     */
 
     /**
-     * Constructor TestSOAPBody
-     *
-     * @param name
-     */
-    public SOAPBodyTest(String name) {
-        super(name);
-    }
-
-    /**
      * Method testSoapBodyBUG
      *
      * @throws Exception
      */
+    @Validated @Test
     public void testSoapBody() throws Exception {
 
         MessageFactory fact = MessageFactory.newInstance();
         SOAPMessage message = fact.createMessage();
         SOAPPart soapPart = message.getSOAPPart();
-        SOAPEnvelopeImpl env = (SOAPEnvelopeImpl)soapPart.getEnvelope();
+        SOAPEnvelope env = soapPart.getEnvelope();
         SOAPHeader header = env.getHeader();
         Name hns = env.createName("Hello",
                                   "shw",
@@ -176,6 +172,7 @@ public class SOAPBodyTest extends TestCa
     }
 
     //TODO : fix
+    @Validated @Test
     public void testExtractContentAsDocument() {
         try {
             MessageFactory fact = MessageFactory.newInstance();
@@ -209,6 +206,7 @@ public class SOAPBodyTest extends TestCa
     /*
      * For SOAP 1.1 message 
      */
+    @Validated @Test
     public void testAddAttribute() {
         try {
             MessageFactory fact = MessageFactory.newInstance();
@@ -227,6 +225,7 @@ public class SOAPBodyTest extends TestCa
     /*
      * For SOAP 1.2 message 
      */
+    @Validated @Test
     public void testAddAttribute2() {
         try {
             MessageFactory fact = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
@@ -244,6 +243,7 @@ public class SOAPBodyTest extends TestCa
     /*
     * For SOAP 1.2 message
     */
+    @Validated @Test
     public void testAddFault() {
         try {
             MessageFactory fact = MessageFactory.newInstance();
@@ -263,6 +263,7 @@ public class SOAPBodyTest extends TestCa
         }
     }
 
+    @Validated @Test
     public void testAppendChild() throws Exception {
         MessageFactory fact = MessageFactory.newInstance();
         SOAPMessage message = fact.createMessage();

Modified: axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPConnectionTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPConnectionTest.java?rev=1029210&r1=1029209&r2=1029210&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPConnectionTest.java (original)
+++ axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/SOAPConnectionTest.java Sat Oct 30 21:56:49 2010
@@ -19,13 +19,15 @@
 
 package org.apache.axis2.saaj;
 
-import junit.framework.TestCase;
+import junit.framework.Assert;
 import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpException;
 import org.apache.commons.httpclient.HttpStatus;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.params.HttpMethodParams;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import javax.xml.soap.SOAPConnection;
 import javax.xml.soap.SOAPConnectionFactory;
@@ -37,7 +39,9 @@ import java.net.URL;
 /**
  * 
  */
-public class SOAPConnectionTest extends TestCase {
+@RunWith(SAAJTestRunner.class)
+public class SOAPConnectionTest extends Assert {
+    @Validated @Test
     public void testClose() {
         try {
             SOAPConnection sCon = SOAPConnectionFactory.newInstance().createConnection();
@@ -47,6 +51,7 @@ public class SOAPConnectionTest extends 
         }
     }
 
+    @Validated @Test
     public void testCloseTwice() {
         SOAPConnectionFactory soapConnectionFactory = null;
         try {
@@ -71,6 +76,7 @@ public class SOAPConnectionTest extends 
         }
     }
 
+    @Validated @Test
     public void testCallOnCloseConnection() {
         SOAPConnectionFactory soapConnectionFactory = null;
         try {
@@ -96,6 +102,7 @@ public class SOAPConnectionTest extends 
     }
 
 
+    @Validated @Test
     public void testGet() {
     	if(isNetworkedResourceAvailable("http://java.sun.com/index.html")){
             try {