You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by he...@apache.org on 2005/07/07 08:10:06 UTC

svn commit: r209566 - in /webservices/axis/trunk/java/modules: core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java samples/maven.xml samples/script/build.xml

Author: hemapani
Date: Wed Jul  6 23:10:04 2005
New Revision: 209566

URL: http://svn.apache.org/viewcvs?rev=209566&view=rev
Log:
update the Commons transport sender for MTOM support

Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
    webservices/axis/trunk/java/modules/samples/maven.xml
    webservices/axis/trunk/java/modules/samples/script/build.xml

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?rev=209566&r1=209565&r2=209566&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Wed Jul  6 23:10:04 2005
@@ -99,14 +99,19 @@
             PostMethod postMethod = new PostMethod();
             postMethod.setPath(url.getFile());
             msgContext.setProperty(HTTP_METHOD,postMethod);
-            postMethod.setRequestEntity(new AxisRequestEntity(dataout, chuncked));
+            postMethod.setRequestEntity(new AxisRequestEntity(dataout, chuncked,msgContext.isDoingMTOM()));
             if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chuncked) {
                 ((PostMethod) postMethod).setContentChunked(true);
             }
 
-            postMethod.setRequestHeader(
-                HTTPConstants.HEADER_CONTENT_TYPE,
-                "text/xml; charset=utf-8");
+            if(msgContext.isDoingMTOM()){
+                postMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
+                            OMOutput.getContentType(true));
+            }else{
+                postMethod.setRequestHeader(
+                    HTTPConstants.HEADER_CONTENT_TYPE,
+                    "text/xml; charset=utf-8");
+            }
             postMethod.setRequestHeader(
                 HTTPConstants.HEADER_ACCEPT,
                 HTTPConstants.HEADER_ACCEPT_APPL_SOAP
@@ -178,10 +183,12 @@
         private OMElement element;
         private boolean chuncked;
         private byte[] bytes;
+        private boolean doingMTOM = false;
 
-        public AxisRequestEntity(OMElement element, boolean chuncked) {
+        public AxisRequestEntity(OMElement element, boolean chuncked,boolean doingMTOM) {
             this.element = element;
             this.chuncked = chuncked;
+            this.doingMTOM = doingMTOM;
         }
         public boolean isRepeatable() {
             return false;
@@ -206,11 +213,9 @@
         public void writeRequest(OutputStream out) throws IOException {
             try {
                 if (chuncked) {
-                    XMLStreamWriter outputWriter = null;
-                    outputWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(out);
-                    OMOutput output = new OMOutput(outputWriter);
+                    OMOutput output = new OMOutput(out,doingMTOM);
                     element.serialize(output);
-                    outputWriter.flush();
+                    output.flush();
                     out.flush();
                 } else {
                     if (bytes == null) {

Modified: webservices/axis/trunk/java/modules/samples/maven.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/maven.xml?rev=209566&r1=209565&r2=209566&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/maven.xml (original)
+++ webservices/axis/trunk/java/modules/samples/maven.xml Wed Jul  6 23:10:04 2005
@@ -297,13 +297,13 @@
                <j:set var="interop3.dir" value="target/interop3"/>
                <j:set var="work.dir" value="${interop3.dir}/work"/>
                <j:set var="calss.dir" value="${interop3.dir}/classes"/>
-                <j:set var="wsdl.dir" value="test-resources/wsdl"/>
+                 <j:set var="wsdl.dir" value="${basedir}/../wsdl/test-resources/"/>
                      
                  <mkdir dir="${interop3.dir}"/>  
 				<mkdir dir="${work.dir}"/>  
 				<mkdir dir="${calss.dir}"/>                       
 				
-		       <wsdl2java WSDLFileName="test-resources/wsdl/compound2.wsdl" output="${work.dir}"/> 
+		       <wsdl2java WSDLFileName="${wsdl.dir}compound2.wsdl" output="${work.dir}"/> 
 		       <!--
 		       <java classname="org.apache.axis2.wsdl.WSDL2Java">
                   <classpath refid="maven.dependency.classpath"/>

Modified: webservices/axis/trunk/java/modules/samples/script/build.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/script/build.xml?rev=209566&r1=209565&r2=209566&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/script/build.xml (original)
+++ webservices/axis/trunk/java/modules/samples/script/build.xml Wed Jul  6 23:10:04 2005
@@ -25,4 +25,7 @@
 		<java classname="userguide.clients.ClientForWebServiceWithModule" classpathref="axis.classpath"/>
 </target>
 
+<target name="testEchoNonBlockingClient">
+		<java classname="userguide.clients.EchoNonBlockingClient" classpathref="axis.classpath"/>
+</target>
 </project>