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 di...@apache.org on 2005/07/14 02:30:59 UTC

svn commit: r216290 [1/8] - in /webservices/axis/trunk/java/modules: core/src/org/apache/axis2/transport/ core/src/org/apache/axis2/transport/http/ core/webapp/ saaj/src/org/apache/axis2/saaj/ samples/src/sample/amazon/search/ samples/src/userguide/cli...

Author: dims
Date: Wed Jul 13 17:30:55 2005
New Revision: 216290

URL: http://svn.apache.org/viewcvs?rev=216290&view=rev
Log:
OMOutput as exists is a hack. So, Am trying to cleanup OMOutput. it is 
the ONLY class in that package that is a Class and not an interface. 
It is an implementation detail and should not leak into the rest of OM. 
This is a first step in refactoring. Please bear with me. Am checking 
this in right now because there will be lots of changes otherwise. 
OMOutput has a static method getContentType which is used inside the
*sender stuff. which needs to be cleaned up. more stuff coming for 
cleaning up mtom stuff. So please stay tuned.


Added:
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MIMEOutputUtils.java
      - copied, changed from r216276, webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/MIMEOutputUtils.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/OMOutputImpl.java
      - copied, changed from r216276, webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMOutput.java
Removed:
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/MIMEOutputUtils.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMOutput.java
Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/AbstractTransportSender.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java
    webservices/axis/trunk/java/modules/core/webapp/HappyAxis.jsp
    webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java
    webservices/axis/trunk/java/modules/samples/src/sample/amazon/search/AsynchronousClient.java
    webservices/axis/trunk/java/modules/samples/src/sample/amazon/search/ClientCallbackHandler.java
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/ClientForWebServiceWithModule.java
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingClient.java
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingDualClient.java
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingClient.java
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingDualClient.java
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/RESTClient.java
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/TCPClient.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/HandlerFailureTest.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/SOAPversionTest.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailRequestResponseRawXMLTest.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailetRequestResponceRawXMLTest.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mtom/EchoRawMTOMToBase64Test.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/rest/RESTBasedEchoRawXMLTest.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/tcp/TCPTwoChannelEchoRawXMLTest.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMSerializer.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMCommentImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocTypeImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNodeImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMProcessingInstructionImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMSerializerUtil.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/serialize/StreamWriterToContentHandlerConverter.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/serialize/StreamingOMSerializer.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultCodeImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultDetailImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultNodeImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultReasonImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultRoleImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap11/SOAP11FaultDetailImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap11/SOAP11FaultImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap11/SOAP11FaultReasonImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap11/SOAP11FaultRoleImpl.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/attachments/ImageSampleTest.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/MIMEOutputUtilsTest.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/OMNavigatorTest.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/SOAPFaultTest.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/OMOutputTest.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/ElementSerializerTest.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/NoNamespaceSerializerTest.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/OMSerializerTest.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/streamwrapper/OmStAXBuilderTest.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/infoset/XMLConformanceTest.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/soap/SOAPFaultTest.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/soap/impl/llom/soap11/SOAP11SerializerTest.java

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/AbstractTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/AbstractTransportSender.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/AbstractTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/AbstractTransportSender.java Wed Jul 13 17:30:55 2005
@@ -1,169 +1,168 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.transport;
-
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.engine.AxisFault;
-import org.apache.axis2.handlers.AbstractHandler;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMOutput;
-import org.apache.axis2.soap.SOAPEnvelope;
-import org.apache.axis2.transport.http.HTTPTransportUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.xml.namespace.QName;
-import java.io.OutputStream;
-
-/**
- * By the time this Class is invoked either the To EPR on the MessageContext
- * should be set or TRANSPORT_WRITER property set in the message Context with a
- * Writer. This Class would write the SOAPMessage using either of the methods in
- * the order To then Writer.
- */
-public abstract class AbstractTransportSender extends AbstractHandler implements
-        TransportSender {
-    /**
-     * Field log
-     */
-    private Log log = LogFactory.getLog(getClass());
-
-
-    /**
-     * Field NAME
-     */
-    public static final QName NAME = new QName("http://axis.ws.apache.org",
-            "TransportSender");
-
-    /**
-     * Constructor AbstractTransportSender
-     */
-    public AbstractTransportSender() {
-        init(new HandlerDescription(NAME));
-    }
-
-    public void init(ConfigurationContext confContext,
-                     TransportOutDescription transportOut) throws AxisFault {
-
-    }
-
-    /**
-     * Method invoke
-     *
-     * @param msgContext
-     * @throws AxisFault
-     */
-    public void invoke(MessageContext msgContext) throws AxisFault {
-        //Check for the REST behaviour, if you desire rest beahaviour
-        //put a <parameter name="doREST" value="true"/> at the axis2.xml
-        msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
-
-        OutputStream out = null;
-
-        EndpointReference epr = null;
-
-        if (msgContext.getTo() != null
-                && !AddressingConstants.Submission.WSA_ANONYMOUS_URL
-                .equals(msgContext.getTo().getAddress())
-                && !AddressingConstants.Final.WSA_ANONYMOUS_URL
-                .equals(msgContext.getTo().getAddress())) {
-            epr = msgContext.getTo();
-        }
-
-        if (epr != null) {
-            out = openTheConnection(epr, msgContext);
-            OutputStream newOut = startSendWithToAddress(msgContext, out);
-            if (newOut != null) {
-                out = newOut;
-            }
-            writeMessage(msgContext, out);
-            finalizeSendWithToAddress(msgContext, out);
-        } else {
-            out = (OutputStream) msgContext
-                    .getProperty(MessageContext.TRANSPORT_OUT);
-            if (out != null) {
-                startSendWithOutputStreamFromIncomingConnection(msgContext,
-                        out);
-                writeMessage(msgContext, out);
-                finalizeSendWithOutputStreamFromIncomingConnection(msgContext,
-                        out);
-            } else {
-                throw new AxisFault(
-                        "Both the TO and Property MessageContext.TRANSPORT_WRITER is Null, No where to send");
-            }
-        }
-        //TODO fix this, we do not set the value if the operation context is
-        // not avalible
-        if (msgContext.getOperationContext() != null) {
-            msgContext.getOperationContext().setProperty(
-                    Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
-        }
-    }
-
-    public void writeMessage(MessageContext msgContext, OutputStream out)
-            throws AxisFault {
-        SOAPEnvelope envelope = msgContext.getEnvelope();
-        OMElement outputMessage = envelope;
-
-        if (envelope != null && msgContext.isDoingREST()) {
-            outputMessage = envelope.getBody().getFirstElement();
-        }
-
-        if (outputMessage != null) {
-            OMOutput omOutput = null;
-
-            try {
-                if (msgContext.isDoingMTOM()) {
-                    omOutput = new OMOutput(out, true);
-                    outputMessage.serialize(omOutput);
-                    omOutput.flush();
-                    omOutput.complete();
-                    out.flush();
-                } else {
-                    omOutput = new OMOutput(out, false);
-                    outputMessage.serialize(omOutput);
-                    omOutput.flush();
-                    out.flush();
-                }
-            } catch (Exception e) {
-                throw new AxisFault("Stream error", e);
-            }
-        } else {
-            throw new AxisFault("the OUTPUT message is Null, nothing to write");
-        }
-    }
-
-    public abstract OutputStream startSendWithToAddress(
-            MessageContext msgContext, OutputStream out) throws AxisFault;
-
-    public abstract void finalizeSendWithToAddress(MessageContext msgContext,
-                                                   OutputStream out) throws AxisFault;
-
-    public abstract OutputStream startSendWithOutputStreamFromIncomingConnection(
-            MessageContext msgContext, OutputStream out) throws AxisFault;
-
-    public abstract void finalizeSendWithOutputStreamFromIncomingConnection(
-            MessageContext msgContext, OutputStream out) throws AxisFault;
-
-    protected abstract OutputStream openTheConnection(EndpointReference epr,
-                                                      MessageContext msgctx) throws AxisFault;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.transport;
+
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.impl.OMOutputImpl;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.transport.http.HTTPTransportUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+import java.io.OutputStream;
+
+/**
+ * By the time this Class is invoked either the To EPR on the MessageContext
+ * should be set or TRANSPORT_WRITER property set in the message Context with a
+ * Writer. This Class would write the SOAPMessage using either of the methods in
+ * the order To then Writer.
+ */
+public abstract class AbstractTransportSender extends AbstractHandler implements
+        TransportSender {
+    /**
+     * Field log
+     */
+    private Log log = LogFactory.getLog(getClass());
+
+
+    /**
+     * Field NAME
+     */
+    public static final QName NAME = new QName("http://axis.ws.apache.org",
+            "TransportSender");
+
+    /**
+     * Constructor AbstractTransportSender
+     */
+    public AbstractTransportSender() {
+        init(new HandlerDescription(NAME));
+    }
+
+    public void init(ConfigurationContext confContext,
+                     TransportOutDescription transportOut) throws AxisFault {
+
+    }
+
+    /**
+     * Method invoke
+     *
+     * @param msgContext
+     * @throws AxisFault
+     */
+    public void invoke(MessageContext msgContext) throws AxisFault {
+        //Check for the REST behaviour, if you desire rest beahaviour
+        //put a <parameter name="doREST" value="true"/> at the axis2.xml
+        msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
+
+        OutputStream out = null;
+
+        EndpointReference epr = null;
+
+        if (msgContext.getTo() != null
+                && !AddressingConstants.Submission.WSA_ANONYMOUS_URL
+                .equals(msgContext.getTo().getAddress())
+                && !AddressingConstants.Final.WSA_ANONYMOUS_URL
+                .equals(msgContext.getTo().getAddress())) {
+            epr = msgContext.getTo();
+        }
+
+        if (epr != null) {
+            out = openTheConnection(epr, msgContext);
+            OutputStream newOut = startSendWithToAddress(msgContext, out);
+            if (newOut != null) {
+                out = newOut;
+            }
+            writeMessage(msgContext, out);
+            finalizeSendWithToAddress(msgContext, out);
+        } else {
+            out = (OutputStream) msgContext
+                    .getProperty(MessageContext.TRANSPORT_OUT);
+            if (out != null) {
+                startSendWithOutputStreamFromIncomingConnection(msgContext,
+                        out);
+                writeMessage(msgContext, out);
+                finalizeSendWithOutputStreamFromIncomingConnection(msgContext,
+                        out);
+            } else {
+                throw new AxisFault(
+                        "Both the TO and Property MessageContext.TRANSPORT_WRITER is Null, No where to send");
+            }
+        }
+        //TODO fix this, we do not set the value if the operation context is
+        // not avalible
+        if (msgContext.getOperationContext() != null) {
+            msgContext.getOperationContext().setProperty(
+                    Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
+        }
+    }
+
+    public void writeMessage(MessageContext msgContext, OutputStream out)
+            throws AxisFault {
+        SOAPEnvelope envelope = msgContext.getEnvelope();
+        OMElement outputMessage = envelope;
+
+        if (envelope != null && msgContext.isDoingREST()) {
+            outputMessage = envelope.getBody().getFirstElement();
+        }
+
+        if (outputMessage != null) {
+            OMOutputImpl omOutput = null;
+
+            try {
+                if (msgContext.isDoingMTOM()) {
+                    omOutput = new org.apache.axis2.om.impl.OMOutputImpl(out, true);
+                    outputMessage.serialize(omOutput);
+                    omOutput.flush();
+                    out.flush();
+                } else {
+                    omOutput = new OMOutputImpl(out, false);
+                    outputMessage.serialize(omOutput);
+                    omOutput.flush();
+                    out.flush();
+                }
+            } catch (Exception e) {
+                throw new AxisFault("Stream error", e);
+            }
+        } else {
+            throw new AxisFault("the OUTPUT message is Null, nothing to write");
+        }
+    }
+
+    public abstract OutputStream startSendWithToAddress(
+            MessageContext msgContext, OutputStream out) throws AxisFault;
+
+    public abstract void finalizeSendWithToAddress(MessageContext msgContext,
+                                                   OutputStream out) throws AxisFault;
+
+    public abstract OutputStream startSendWithOutputStreamFromIncomingConnection(
+            MessageContext msgContext, OutputStream out) throws AxisFault;
+
+    public abstract void finalizeSendWithOutputStreamFromIncomingConnection(
+            MessageContext msgContext, OutputStream out) throws AxisFault;
+
+    protected abstract OutputStream openTheConnection(EndpointReference epr,
+                                                      MessageContext msgctx) throws AxisFault;
 }

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=216290&r1=216289&r2=216290&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 13 17:30:55 2005
@@ -1,365 +1,362 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.axis2.transport.http;
-
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.engine.AxisFault;
-import org.apache.axis2.handlers.AbstractHandler;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMOutput;
-import org.apache.axis2.transport.TransportSender;
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HostConfiguration;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.RequestEntity;
-
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-public class CommonsHTTPTransportSender extends AbstractHandler implements
-        TransportSender {
-    private boolean chuncked = false;
-
-    private String httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
-
-    public static final String HTTP_METHOD = "HTTP_METHOD";
-
-    protected HttpClient httpClient;
-
-    protected OMElement outputMessage;
-
-    public CommonsHTTPTransportSender() {
-    } //default
-
-    public void invoke(MessageContext msgContext) throws AxisFault {
-        try {
-            //Check for the REST behaviour, if you desire rest beahaviour
-            //put a <parameter name="doREST" value="true"/> at the
-            // server.xml/client.xml file
-            msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
-
-            EndpointReference epr = null;
-            if (msgContext.getTo() != null
-                    && !AddressingConstants.Submission.WSA_ANONYMOUS_URL
-                    .equals(msgContext.getTo().getAddress())
-                    && !AddressingConstants.Final.WSA_ANONYMOUS_URL
-                    .equals(msgContext.getTo().getAddress())) {
-                epr = msgContext.getTo();
-            }
-
-            OMElement dataOut = null;
-            if (msgContext.isDoingREST()) {
-                dataOut = msgContext.getEnvelope().getFirstElement();
-            } else {
-                dataOut = msgContext.getEnvelope();
-            }
-
-            //TODO timeout, configuration
-            if (epr != null) {
-                writeMessageWithCommons(msgContext, epr, dataOut);
-            } else {
-                OutputStream out = (OutputStream) msgContext
-                        .getProperty(MessageContext.TRANSPORT_OUT);
-                OMOutput output = new OMOutput(out, false);
-                dataOut.serialize(output);
-            }
-            msgContext.getOperationContext().setProperty(
-                    Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
-        } catch (XMLStreamException e) {
-            throw new AxisFault(e);
-        } catch (FactoryConfigurationError e) {
-            throw new AxisFault(e);
-        }
-    }
-
-    public void writeMessageWithToOutPutStream(MessageContext msgContext,
-                                               OutputStream out) {
-
-    }
-
-    public void writeMessageWithCommons(MessageContext msgContext,
-                                        EndpointReference toURL,
-                                        OMElement dataout) throws AxisFault {
-        try {
-            URL url = new URL(toURL.getAddress());
-            //Configure the transport
-            String soapAction = msgContext.getWSAAction();
-            //settign soapAction
-            String soapActionString = soapAction == null ? "" : soapAction
-                    .toString();
-
-            PostMethod postMethod = new PostMethod();
-            postMethod.setPath(url.getFile());
-            msgContext.setProperty(HTTP_METHOD, postMethod);
-            postMethod.setRequestEntity(
-                    new AxisRequestEntity(dataout,
-                            chuncked, msgContext.isDoingMTOM()));
-            if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)
-                    && chuncked) {
-                ((PostMethod) postMethod).setContentChunked(true);
-            }
-
-            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
-                    + HTTPConstants.HEADER_ACCEPT_APPLICATION_DIME
-                    + HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED
-                    + HTTPConstants.HEADER_ACCEPT_TEXT_ALL);
-            postMethod.setRequestHeader(HTTPConstants.HEADER_HOST, url
-                    .getHost());
-            postMethod.setRequestHeader(HTTPConstants.HEADER_CACHE_CONTROL,
-                    "no-cache");
-            postMethod
-                    .setRequestHeader(HTTPConstants.HEADER_PRAGMA, "no-cache");
-            //content length is not set yet
-            //setting HTTP vesion
-
-            if (httpVersion != null) {
-                if (httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)) {
-                    //postMethod.setHttp11(false); todo method to findout the
-                    // transport version...
-                    //allowing keep-alive for 1.0
-                    postMethod.setRequestHeader(
-                            HTTPConstants.HEADER_CONNECTION,
-                            HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
-                } else {
-                    // allowing keep-alive for 1.1
-                    postMethod.setRequestHeader(
-                            HTTPConstants.HEADER_CONNECTION,
-                            HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
-                }
-            }
-            // othervise assumes HTTP 1.1 and keep-alive is default.
-            if (!msgContext.isDoingREST()) {
-                postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION,
-                        soapActionString);
-            }
-
-            //execuite the HtttpMethodBase - a connection manager can be given
-            // for handle multiple
-            httpClient = new HttpClient();
-            //hostConfig handles the socket functions..
-            HostConfiguration hostConfig = getHostConfiguration(msgContext,
-                    url);
-
-            //code that wirte the stream to the wire
-
-            this.httpClient.executeMethod(hostConfig, postMethod);
-            if (postMethod.getStatusCode() == HttpStatus.SC_OK) {
-                InputStream in = postMethod.getResponseBodyAsStream();
-                if (in == null) {
-                    throw new AxisFault("Input Stream can not be Null");
-                }
-                msgContext.getOperationContext().setProperty(
-                        MessageContext.TRANSPORT_IN, in);
-                Header contentTypeHeader = postMethod
-                        .getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
-                if (contentTypeHeader != null) {
-                    String contentType = contentTypeHeader.getValue();
-                    if (contentType != null
-                            &&
-                            contentType
-                            .indexOf(
-                                    HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >=
-                            0) {
-                        OperationContext opContext = msgContext
-                                .getOperationContext();
-                        if (opContext != null) {
-                            opContext.setProperty(
-                                    HTTPConstants.MTOM_RECIVED_CONTENT_TYPE,
-                                    contentType);
-                        }
-                    }
-                }
-
-            } else if (postMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
-                return;
-            } else {
-                throw new AxisFault("Error " + postMethod.getStatusCode()
-                        + "  Error Message is "
-                        + postMethod.getResponseBodyAsString());
-            }
-        } catch (MalformedURLException e) {
-            throw new AxisFault(e);
-        } catch (HttpException e) {
-            throw new AxisFault(e);
-        } catch (IOException e) {
-            throw new AxisFault(e);
-        }
-
-    }
-
-    protected HostConfiguration getHostConfiguration(MessageContext context,
-                                                     URL targetURL) {
-        //TODO cheaking wheather the host is a proxy
-        HostConfiguration config = new HostConfiguration();
-        config.setHost(targetURL.getHost(), targetURL.getPort() == -1 ? 80
-                : targetURL.getPort());
-        return config;
-    }
-
-    //get the contentLength...
-    public class AxisRequestEntity implements RequestEntity {
-        private OMElement element;
-
-        private boolean chuncked;
-
-        private byte[] bytes;
-
-        private boolean doingMTOM = false;
-
-        public AxisRequestEntity(OMElement element, boolean chuncked,
-                                 boolean doingMTOM) {
-            this.element = element;
-            this.chuncked = chuncked;
-            this.doingMTOM = doingMTOM;
-        }
-
-        public boolean isRepeatable() {
-            return false;
-        }
-
-        public byte[] writeBytes() throws AxisFault {
-            try {
-                ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
-                XMLStreamWriter outputWriter = XMLOutputFactory.newInstance()
-                        .createXMLStreamWriter(bytesOut);
-                OMOutput output = new OMOutput(outputWriter);
-                element.serialize(output);
-                outputWriter.flush();
-                return bytesOut.toByteArray();
-            } catch (XMLStreamException e) {
-                throw new AxisFault(e);
-            } catch (FactoryConfigurationError e) {
-                throw new AxisFault(e);
-            }
-        }
-
-        public void writeRequest(OutputStream out) throws IOException {
-            try {
-                if (chuncked || doingMTOM) {
-                    OMOutput output = new OMOutput(out, doingMTOM);
-                    element.serialize(output);
-                    if (doingMTOM)
-                        output.complete();
-                    output.flush();
-                    out.flush();
-                } else {
-                    if (bytes == null) {
-                        bytes = writeBytes();
-                    }
-                    out.write(bytes);
-                }
-            } catch (XMLStreamException e) {
-                throw new AxisFault(e);
-            } catch (FactoryConfigurationError e) {
-                throw new AxisFault(e);
-            } catch (IOException e) {
-                throw new AxisFault(e);
-            }
-        }
-
-        public long getContentLength() {
-            try {
-                if (chuncked) {
-                    return -1;
-                } else {
-                    if (bytes == null) {
-                        bytes = writeBytes();
-                    }
-                    return bytes.length;
-                }
-            } catch (AxisFault e) {
-                return -1;
-            }
-        }
-
-        public String getContentType() {
-            return "text/xml; charset=utf-8";
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.axis2.transport.TransportSender#cleanUp(org.apache.axis2.context.MessageContext)
-     */
-    public void cleanUp(MessageContext msgContext) throws AxisFault {
-        HttpMethod httpMethod = (HttpMethod) msgContext
-                .getProperty(HTTP_METHOD);
-        if (httpMethod != null) {
-            httpMethod.releaseConnection();
-        }
-
-    }
-
-    public void init(ConfigurationContext confContext,
-                     TransportOutDescription transportOut) throws AxisFault {
-        //<parameter name="PROTOCOL" locked="xsd:false">HTTP/1.0</parameter> or
-        //<parameter name="PROTOCOL" locked="xsd:false">HTTP/1.1</parameter> is
-        // checked
-        Parameter version = transportOut
-                .getParameter(HTTPConstants.PROTOCOL_VERSION);
-        if (version != null) {
-            if (HTTPConstants.HEADER_PROTOCOL_11.equals(version.getValue())) {
-                this.httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
-                Parameter transferEncoding = transportOut
-                        .getParameter(HTTPConstants.HEADER_TRANSFER_ENCODING);
-                if (transferEncoding != null
-                        && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED
-                        .equals(transferEncoding.getValue())) {
-                    this.chuncked = true;
-                }
-            } else if (HTTPConstants.HEADER_PROTOCOL_10.equals(version
-                    .getValue())) {
-                //TODO HTTP1.0 specific parameters
-            } else {
-                throw new AxisFault(
-                        "Parameter "
-                        + HTTPConstants.PROTOCOL_VERSION
-                        + " Can have values only HTTP/1.0 or HTTP/1.1");
-            }
-        }
-
-    }
-
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.axis2.transport.http;
+
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.impl.OMOutputImpl;
+import org.apache.axis2.transport.TransportSender;
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HostConfiguration;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.RequestEntity;
+
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class CommonsHTTPTransportSender extends AbstractHandler implements
+        TransportSender {
+    private boolean chuncked = false;
+
+    private String httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
+
+    public static final String HTTP_METHOD = "HTTP_METHOD";
+
+    protected HttpClient httpClient;
+
+    protected OMElement outputMessage;
+
+    public CommonsHTTPTransportSender() {
+    } //default
+
+    public void invoke(MessageContext msgContext) throws AxisFault {
+        try {
+            //Check for the REST behaviour, if you desire rest beahaviour
+            //put a <parameter name="doREST" value="true"/> at the
+            // server.xml/client.xml file
+            msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
+
+            EndpointReference epr = null;
+            if (msgContext.getTo() != null
+                    && !AddressingConstants.Submission.WSA_ANONYMOUS_URL
+                    .equals(msgContext.getTo().getAddress())
+                    && !AddressingConstants.Final.WSA_ANONYMOUS_URL
+                    .equals(msgContext.getTo().getAddress())) {
+                epr = msgContext.getTo();
+            }
+
+            OMElement dataOut = null;
+            if (msgContext.isDoingREST()) {
+                dataOut = msgContext.getEnvelope().getFirstElement();
+            } else {
+                dataOut = msgContext.getEnvelope();
+            }
+
+            //TODO timeout, configuration
+            if (epr != null) {
+                writeMessageWithCommons(msgContext, epr, dataOut);
+            } else {
+                OutputStream out = (OutputStream) msgContext
+                        .getProperty(MessageContext.TRANSPORT_OUT);
+                OMOutputImpl output = new OMOutputImpl(out, false);
+                dataOut.serialize(output);
+            }
+            msgContext.getOperationContext().setProperty(
+                    Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
+        } catch (XMLStreamException e) {
+            throw new AxisFault(e);
+        } catch (FactoryConfigurationError e) {
+            throw new AxisFault(e);
+        }
+    }
+
+    public void writeMessageWithToOutPutStream(MessageContext msgContext,
+                                               OutputStream out) {
+
+    }
+
+    public void writeMessageWithCommons(MessageContext msgContext,
+                                        EndpointReference toURL,
+                                        OMElement dataout) throws AxisFault {
+        try {
+            URL url = new URL(toURL.getAddress());
+            //Configure the transport
+            String soapAction = msgContext.getWSAAction();
+            //settign soapAction
+            String soapActionString = soapAction == null ? "" : soapAction
+                    .toString();
+
+            PostMethod postMethod = new PostMethod();
+            postMethod.setPath(url.getFile());
+            msgContext.setProperty(HTTP_METHOD, postMethod);
+            postMethod.setRequestEntity(
+                    new AxisRequestEntity(dataout,
+                            chuncked, msgContext.isDoingMTOM()));
+            if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)
+                    && chuncked) {
+                ((PostMethod) postMethod).setContentChunked(true);
+            }
+
+            if (msgContext.isDoingMTOM()) {
+                postMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
+                        OMOutputImpl.getContentType(true));
+            } else {
+                postMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
+                        "text/xml; charset=utf-8");
+            }
+            postMethod.setRequestHeader(HTTPConstants.HEADER_ACCEPT,
+                    HTTPConstants.HEADER_ACCEPT_APPL_SOAP
+                    + HTTPConstants.HEADER_ACCEPT_APPLICATION_DIME
+                    + HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED
+                    + HTTPConstants.HEADER_ACCEPT_TEXT_ALL);
+            postMethod.setRequestHeader(HTTPConstants.HEADER_HOST, url
+                    .getHost());
+            postMethod.setRequestHeader(HTTPConstants.HEADER_CACHE_CONTROL,
+                    "no-cache");
+            postMethod
+                    .setRequestHeader(HTTPConstants.HEADER_PRAGMA, "no-cache");
+            //content length is not set yet
+            //setting HTTP vesion
+
+            if (httpVersion != null) {
+                if (httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)) {
+                    //postMethod.setHttp11(false); todo method to findout the
+                    // transport version...
+                    //allowing keep-alive for 1.0
+                    postMethod.setRequestHeader(
+                            HTTPConstants.HEADER_CONNECTION,
+                            HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
+                } else {
+                    // allowing keep-alive for 1.1
+                    postMethod.setRequestHeader(
+                            HTTPConstants.HEADER_CONNECTION,
+                            HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
+                }
+            }
+            // othervise assumes HTTP 1.1 and keep-alive is default.
+            if (!msgContext.isDoingREST()) {
+                postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION,
+                        soapActionString);
+            }
+
+            //execuite the HtttpMethodBase - a connection manager can be given
+            // for handle multiple
+            httpClient = new HttpClient();
+            //hostConfig handles the socket functions..
+            HostConfiguration hostConfig = getHostConfiguration(msgContext,
+                    url);
+
+            //code that wirte the stream to the wire
+
+            this.httpClient.executeMethod(hostConfig, postMethod);
+            if (postMethod.getStatusCode() == HttpStatus.SC_OK) {
+                InputStream in = postMethod.getResponseBodyAsStream();
+                if (in == null) {
+                    throw new AxisFault("Input Stream can not be Null");
+                }
+                msgContext.getOperationContext().setProperty(
+                        MessageContext.TRANSPORT_IN, in);
+                Header contentTypeHeader = postMethod
+                        .getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+                if (contentTypeHeader != null) {
+                    String contentType = contentTypeHeader.getValue();
+                    if (contentType != null
+                            &&
+                            contentType
+                            .indexOf(
+                                    HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >=
+                            0) {
+                        OperationContext opContext = msgContext
+                                .getOperationContext();
+                        if (opContext != null) {
+                            opContext.setProperty(
+                                    HTTPConstants.MTOM_RECIVED_CONTENT_TYPE,
+                                    contentType);
+                        }
+                    }
+                }
+
+            } else if (postMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
+                return;
+            } else {
+                throw new AxisFault("Error " + postMethod.getStatusCode()
+                        + "  Error Message is "
+                        + postMethod.getResponseBodyAsString());
+            }
+        } catch (MalformedURLException e) {
+            throw new AxisFault(e);
+        } catch (HttpException e) {
+            throw new AxisFault(e);
+        } catch (IOException e) {
+            throw new AxisFault(e);
+        }
+
+    }
+
+    protected HostConfiguration getHostConfiguration(MessageContext context,
+                                                     URL targetURL) {
+        //TODO cheaking wheather the host is a proxy
+        HostConfiguration config = new HostConfiguration();
+        config.setHost(targetURL.getHost(), targetURL.getPort() == -1 ? 80
+                : targetURL.getPort());
+        return config;
+    }
+
+    //get the contentLength...
+    public class AxisRequestEntity implements RequestEntity {
+        private OMElement element;
+
+        private boolean chuncked;
+
+        private byte[] bytes;
+
+        private boolean doingMTOM = false;
+
+        public AxisRequestEntity(OMElement element, boolean chuncked,
+                                 boolean doingMTOM) {
+            this.element = element;
+            this.chuncked = chuncked;
+            this.doingMTOM = doingMTOM;
+        }
+
+        public boolean isRepeatable() {
+            return false;
+        }
+
+        public byte[] writeBytes() throws AxisFault {
+            try {
+                ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
+                XMLStreamWriter outputWriter = XMLOutputFactory.newInstance()
+                        .createXMLStreamWriter(bytesOut);
+                element.serialize(outputWriter);
+                outputWriter.flush();
+                return bytesOut.toByteArray();
+            } catch (XMLStreamException e) {
+                throw new AxisFault(e);
+            } catch (FactoryConfigurationError e) {
+                throw new AxisFault(e);
+            }
+        }
+
+        public void writeRequest(OutputStream out) throws IOException {
+            try {
+                if (chuncked || doingMTOM) {
+                    OMOutputImpl output = new OMOutputImpl(out, doingMTOM);
+                    element.serialize(output);
+                    output.flush();
+                    out.flush();
+                } else {
+                    if (bytes == null) {
+                        bytes = writeBytes();
+                    }
+                    out.write(bytes);
+                }
+            } catch (XMLStreamException e) {
+                throw new AxisFault(e);
+            } catch (FactoryConfigurationError e) {
+                throw new AxisFault(e);
+            } catch (IOException e) {
+                throw new AxisFault(e);
+            }
+        }
+
+        public long getContentLength() {
+            try {
+                if (chuncked) {
+                    return -1;
+                } else {
+                    if (bytes == null) {
+                        bytes = writeBytes();
+                    }
+                    return bytes.length;
+                }
+            } catch (AxisFault e) {
+                return -1;
+            }
+        }
+
+        public String getContentType() {
+            return "text/xml; charset=utf-8";
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.axis2.transport.TransportSender#cleanUp(org.apache.axis2.context.MessageContext)
+     */
+    public void cleanUp(MessageContext msgContext) throws AxisFault {
+        HttpMethod httpMethod = (HttpMethod) msgContext
+                .getProperty(HTTP_METHOD);
+        if (httpMethod != null) {
+            httpMethod.releaseConnection();
+        }
+
+    }
+
+    public void init(ConfigurationContext confContext,
+                     TransportOutDescription transportOut) throws AxisFault {
+        //<parameter name="PROTOCOL" locked="xsd:false">HTTP/1.0</parameter> or
+        //<parameter name="PROTOCOL" locked="xsd:false">HTTP/1.1</parameter> is
+        // checked
+        Parameter version = transportOut
+                .getParameter(HTTPConstants.PROTOCOL_VERSION);
+        if (version != null) {
+            if (HTTPConstants.HEADER_PROTOCOL_11.equals(version.getValue())) {
+                this.httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
+                Parameter transferEncoding = transportOut
+                        .getParameter(HTTPConstants.HEADER_TRANSFER_ENCODING);
+                if (transferEncoding != null
+                        && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED
+                        .equals(transferEncoding.getValue())) {
+                    this.chuncked = true;
+                }
+            } else if (HTTPConstants.HEADER_PROTOCOL_10.equals(version
+                    .getValue())) {
+                //TODO HTTP1.0 specific parameters
+            } else {
+                throw new AxisFault(
+                        "Parameter "
+                        + HTTPConstants.PROTOCOL_VERSION
+                        + " Can have values only HTTP/1.0 or HTTP/1.1");
+            }
+        }
+
+    }
+
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java Wed Jul 13 17:30:55 2005
@@ -1,342 +1,342 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package org.apache.axis2.transport.http;
-
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.engine.AxisFault;
-import org.apache.axis2.om.OMOutput;
-import org.apache.axis2.soap.impl.llom.soap11.SOAP11Constants;
-import org.apache.axis2.soap.impl.llom.soap12.SOAP12Constants;
-import org.apache.axis2.transport.AbstractTransportSender;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.InetSocketAddress;
-import java.net.MalformedURLException;
-import java.net.Socket;
-import java.net.SocketAddress;
-import java.net.URL;
-import java.util.Map;
-
-/**
- * Class HTTPTransportSender
- */
-public class HTTPTransportSender extends AbstractTransportSender {
-    private boolean chuncked = false;
-
-    private String httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
-    public static final String TRANSPORT_SENDER_INFO = "TRANSPORT_SENDER_INFO";
-
-    protected void writeTransportHeaders(OutputStream out,
-                                         URL url,
-                                         MessageContext msgContext,
-                                         int contentLength)
-            throws AxisFault {
-        try {
-
-            String soapActionString = msgContext.getSoapAction();
-            if (soapActionString == null || soapActionString.length() == 0) {
-                soapActionString = msgContext.getWSAAction();
-            }
-            if (soapActionString == null) {
-                soapActionString = "";
-            }
-
-            boolean doMTOM = msgContext.isDoingMTOM();
-            StringBuffer buf = new StringBuffer();
-            buf.append(HTTPConstants.HEADER_POST).append(" ");
-            buf.append(url.getFile()).append(" ").append(httpVersion).append(
-                    "\n");
-            if (doMTOM) {
-                buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ")
-                        .append(OMOutput.getContentType(true))
-                        .append("\n");
-            } else {
-                String nsURI = msgContext.getEnvelope().getNamespace().getName();
-                if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
-                    buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ")
-                            .append(SOAP12Constants.SOAP_12_CONTENT_TYPE);
-                    buf.append("; charset=utf-8\n");
-                } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
-                        nsURI)) {
-                    buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(
-                            ": text/xml; charset=utf-8\n");
-                } else {
-                    throw new AxisFault(
-                            "Unknown SOAP Version. Current Axis handles only SOAP 1.1 and SOAP 1.2 messages");
-                }
-
-            }
-
-            buf.append(HTTPConstants.HEADER_ACCEPT).append(
-                    ": application/soap+xml, application/dime, multipart/related, text/*\n");
-            buf.append(HTTPConstants.HEADER_HOST).append(": ").append(
-                    url.getHost())
-                    .append("\n");
-            buf.append(HTTPConstants.HEADER_CACHE_CONTROL).append(
-                    ": no-cache\n");
-            buf.append(HTTPConstants.HEADER_PRAGMA).append(": no-cache\n");
-            if (chuncked) {
-                buf
-                        .append(HTTPConstants.HEADER_TRANSFER_ENCODING)
-                        .append(": ")
-                        .append(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED)
-                        .append("\n");
-            }
-            if (!chuncked && !msgContext.isDoingMTOM()) {
-                buf.append(HTTPConstants.HEADER_CONTENT_LENGTH).append(
-                        ": " + contentLength + "\n");
-            }
-            if (!msgContext.isDoingREST()) {
-                buf.append("SOAPAction: \"" + soapActionString + "\"\n");
-            }
-            buf.append("\n");
-            out.write(buf.toString().getBytes());
-        } catch (IOException e) {
-            throw new AxisFault(e);
-        }
-    }
-
-    public void finalizeSendWithOutputStreamFromIncomingConnection(
-            MessageContext msgContext,
-            OutputStream out) {
-    }
-
-    private OutputStream openSocket(MessageContext msgContext)
-            throws AxisFault {
-        TransportSenderInfo transportInfo =
-                (TransportSenderInfo) msgContext.getProperty(
-                        TRANSPORT_SENDER_INFO);
-
-        EndpointReference toURL = msgContext.getTo();
-        if (toURL != null) {
-            try {
-                URL url = new URL(toURL.getAddress());
-                SocketAddress add =
-                        new InetSocketAddress(url.getHost(),
-                                url.getPort() == -1 ? 80 : url.getPort());
-                Socket socket = new Socket();
-                socket.connect(add);
-                transportInfo.url = url;
-                transportInfo.in = socket.getInputStream();
-                transportInfo.out = socket.getOutputStream();
-                transportInfo.socket = socket;
-                return transportInfo.out;
-            } catch (MalformedURLException e) {
-                throw new AxisFault(e.getMessage(), e);
-            } catch (IOException e) {
-                throw new AxisFault(e.getMessage(), e);
-            }
-        } else {
-            throw new AxisFault("to EPR must be specified");
-        }
-    }
-
-    public void finalizeSendWithToAddress(MessageContext msgContext,
-                                          OutputStream out)
-            throws AxisFault {
-        try {
-            TransportSenderInfo transportInfo =
-                    (TransportSenderInfo) msgContext.getProperty(
-                            TRANSPORT_SENDER_INFO);
-            InputStream in = null;
-            if (chuncked || msgContext.isDoingMTOM()) {
-                if (chuncked) {
-                    ((ChunkedOutputStream) out).eos();
-                    in = new ChunkedInputStream(transportInfo.in);
-                }
-                in = transportInfo.in;
-            } else {
-                openSocket(msgContext);
-                OutputStream outS = transportInfo.out;
-                in = transportInfo.in;
-                byte[] bytes = transportInfo.outputStream.toByteArray();
-
-                //write header to the out put stream
-                writeTransportHeaders(outS,
-                        transportInfo.url,
-                        msgContext,
-                        bytes.length);
-                outS.flush();
-                //write the content to the real output stream
-                outS.write(bytes);
-            }
-
-            transportInfo.socket.shutdownOutput();
-            HTTPTransportReceiver tr = new HTTPTransportReceiver();
-            Map map = tr.parseTheHeaders(transportInfo.in, false);
-            if (!HTTPConstants
-                    .RESPONSE_ACK_CODE_VAL
-                    .equals(map.get(HTTPConstants.RESPONSE_CODE))) {
-                String transferEncoding =
-                        (String) map.get(
-                                HTTPConstants.HEADER_TRANSFER_ENCODING);
-                if (transferEncoding != null
-                        &&
-                        HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(
-                                transferEncoding)) {
-                    in = new ChunkedInputStream(transportInfo.in);
-                }
-                msgContext.setProperty(MessageContext.TRANSPORT_IN, in);
-
-                String contentType = (String) map.get(
-                        HTTPConstants.HEADER_CONTENT_TYPE);
-                if (contentType != null &&
-                        contentType.indexOf(
-                                HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >=
-                        0) {
-                    OperationContext opContext = msgContext.getOperationContext();
-                    if (opContext != null) {
-                        opContext.setProperty(
-                                HTTPConstants.MTOM_RECIVED_CONTENT_TYPE,
-                                contentType);
-                    }
-                }
-            }
-        } catch (IOException e) {
-            throw new AxisFault(e);
-        }
-
-    }
-
-    protected OutputStream openTheConnection(EndpointReference epr,
-                                             MessageContext msgctx)
-            throws AxisFault {
-        msgctx.setProperty(TRANSPORT_SENDER_INFO, new TransportSenderInfo());
-
-        if (msgctx.isDoingMTOM() || chuncked) {
-            return openSocket(msgctx);
-        } else {
-            TransportSenderInfo transportInfo =
-                    (TransportSenderInfo) msgctx.getProperty(
-                            TRANSPORT_SENDER_INFO);
-            transportInfo.outputStream = new ByteArrayOutputStream();
-            return transportInfo.outputStream;
-        }
-    }
-
-    public OutputStream startSendWithOutputStreamFromIncomingConnection(
-            MessageContext msgContext,
-            OutputStream out)
-            throws AxisFault {
-        if (msgContext.isDoingMTOM()) {
-            HTTPOutTransportInfo httpOutTransportInfo = (HTTPOutTransportInfo) msgContext.getProperty(
-                    HTTPConstants.HTTPOutTransportInfo);
-            if (httpOutTransportInfo != null) {
-                httpOutTransportInfo.setContentType(
-                        OMOutput.getContentType(true));
-            } else {
-                throw new AxisFault(
-                        "Property " + HTTPConstants.HTTPOutTransportInfo +
-                        " not set by the Server");
-            }
-
-        }
-        return out;
-    }
-
-    public OutputStream startSendWithToAddress(MessageContext msgContext,
-                                               OutputStream out)
-            throws AxisFault {
-        try {
-            if (msgContext.isDoingMTOM() || chuncked) {
-                TransportSenderInfo transportInfo =
-                        (TransportSenderInfo) msgContext.getProperty(
-                                TRANSPORT_SENDER_INFO);
-                writeTransportHeaders(out, transportInfo.url, msgContext, -1);
-                out.flush();
-                if (chuncked) {
-                    return new ChunkedOutputStream(out);
-                } else {
-                    return out;
-                }
-            } else {
-                return out;
-            }
-        } catch (IOException e) {
-            throw new AxisFault(e);
-        }
-
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.axis2.transport.TransportSender#cleanUp()
-     */
-    public void cleanUp(MessageContext msgContext) throws AxisFault {
-        TransportSenderInfo transportInfo =
-                (TransportSenderInfo) msgContext.getProperty(
-                        TRANSPORT_SENDER_INFO);
-        try {
-            if (transportInfo.socket != null) {
-                transportInfo.socket.close();
-            }
-
-        } catch (IOException e) {
-        }
-
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.axis2.transport.TransportSender#init(org.apache.axis2.context.ConfigurationContext, org.apache.axis2.description.TransportOutDescription)
-     */
-    public void init(ConfigurationContext confContext,
-                     TransportOutDescription transportOut)
-            throws AxisFault {
-        //<parameter name="PROTOCOL" locked="xsd:false">HTTP/1.0</parameter> or 
-        //<parameter name="PROTOCOL" locked="xsd:false">HTTP/1.1</parameter> is checked
-        Parameter version =
-                transportOut.getParameter(HTTPConstants.PROTOCOL_VERSION);
-        if (version != null) {
-            if (HTTPConstants.HEADER_PROTOCOL_11.equals(version.getValue())) {
-                this.httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
-                Parameter transferEncoding =
-                        transportOut.getParameter(
-                                HTTPConstants.HEADER_TRANSFER_ENCODING);
-                if (transferEncoding != null
-                        &&
-                        HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(
-                                transferEncoding.getValue())) {
-                    this.chuncked = true;
-                }
-            } else if (
-                    HTTPConstants.HEADER_PROTOCOL_10.equals(version.getValue())) {
-                //TODO HTTP1.0 specific parameters
-            } else {
-                throw new AxisFault(
-                        "Parameter "
-                        + HTTPConstants.PROTOCOL_VERSION
-                        + " Can have values only HTTP/1.0 or HTTP/1.1");
-            }
-        }
-
-    }
-
-    private class TransportSenderInfo {
-        public InputStream in;
-        public OutputStream out;
-        public ByteArrayOutputStream outputStream;
-        public URL url;
-        public Socket socket;
-    }
-
-}
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.axis2.transport.http;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.om.impl.OMOutputImpl;
+import org.apache.axis2.soap.impl.llom.soap11.SOAP11Constants;
+import org.apache.axis2.soap.impl.llom.soap12.SOAP12Constants;
+import org.apache.axis2.transport.AbstractTransportSender;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.net.URL;
+import java.util.Map;
+
+/**
+ * Class HTTPTransportSender
+ */
+public class HTTPTransportSender extends AbstractTransportSender {
+    private boolean chuncked = false;
+
+    private String httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
+    public static final String TRANSPORT_SENDER_INFO = "TRANSPORT_SENDER_INFO";
+
+    protected void writeTransportHeaders(OutputStream out,
+                                         URL url,
+                                         MessageContext msgContext,
+                                         int contentLength)
+            throws AxisFault {
+        try {
+
+            String soapActionString = msgContext.getSoapAction();
+            if (soapActionString == null || soapActionString.length() == 0) {
+                soapActionString = msgContext.getWSAAction();
+            }
+            if (soapActionString == null) {
+                soapActionString = "";
+            }
+
+            boolean doMTOM = msgContext.isDoingMTOM();
+            StringBuffer buf = new StringBuffer();
+            buf.append(HTTPConstants.HEADER_POST).append(" ");
+            buf.append(url.getFile()).append(" ").append(httpVersion).append(
+                    "\n");
+            if (doMTOM) {
+                buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ")
+                        .append(OMOutputImpl.getContentType(true))
+                        .append("\n");
+            } else {
+                String nsURI = msgContext.getEnvelope().getNamespace().getName();
+                if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
+                    buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ")
+                            .append(SOAP12Constants.SOAP_12_CONTENT_TYPE);
+                    buf.append("; charset=utf-8\n");
+                } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
+                        nsURI)) {
+                    buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(
+                            ": text/xml; charset=utf-8\n");
+                } else {
+                    throw new AxisFault(
+                            "Unknown SOAP Version. Current Axis handles only SOAP 1.1 and SOAP 1.2 messages");
+                }
+
+            }
+
+            buf.append(HTTPConstants.HEADER_ACCEPT).append(
+                    ": application/soap+xml, application/dime, multipart/related, text/*\n");
+            buf.append(HTTPConstants.HEADER_HOST).append(": ").append(
+                    url.getHost())
+                    .append("\n");
+            buf.append(HTTPConstants.HEADER_CACHE_CONTROL).append(
+                    ": no-cache\n");
+            buf.append(HTTPConstants.HEADER_PRAGMA).append(": no-cache\n");
+            if (chuncked) {
+                buf
+                        .append(HTTPConstants.HEADER_TRANSFER_ENCODING)
+                        .append(": ")
+                        .append(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED)
+                        .append("\n");
+            }
+            if (!chuncked && !msgContext.isDoingMTOM()) {
+                buf.append(HTTPConstants.HEADER_CONTENT_LENGTH).append(
+                        ": " + contentLength + "\n");
+            }
+            if (!msgContext.isDoingREST()) {
+                buf.append("SOAPAction: \"" + soapActionString + "\"\n");
+            }
+            buf.append("\n");
+            out.write(buf.toString().getBytes());
+        } catch (IOException e) {
+            throw new AxisFault(e);
+        }
+    }
+
+    public void finalizeSendWithOutputStreamFromIncomingConnection(
+            MessageContext msgContext,
+            OutputStream out) {
+    }
+
+    private OutputStream openSocket(MessageContext msgContext)
+            throws AxisFault {
+        TransportSenderInfo transportInfo =
+                (TransportSenderInfo) msgContext.getProperty(
+                        TRANSPORT_SENDER_INFO);
+
+        EndpointReference toURL = msgContext.getTo();
+        if (toURL != null) {
+            try {
+                URL url = new URL(toURL.getAddress());
+                SocketAddress add =
+                        new InetSocketAddress(url.getHost(),
+                                url.getPort() == -1 ? 80 : url.getPort());
+                Socket socket = new Socket();
+                socket.connect(add);
+                transportInfo.url = url;
+                transportInfo.in = socket.getInputStream();
+                transportInfo.out = socket.getOutputStream();
+                transportInfo.socket = socket;
+                return transportInfo.out;
+            } catch (MalformedURLException e) {
+                throw new AxisFault(e.getMessage(), e);
+            } catch (IOException e) {
+                throw new AxisFault(e.getMessage(), e);
+            }
+        } else {
+            throw new AxisFault("to EPR must be specified");
+        }
+    }
+
+    public void finalizeSendWithToAddress(MessageContext msgContext,
+                                          OutputStream out)
+            throws AxisFault {
+        try {
+            TransportSenderInfo transportInfo =
+                    (TransportSenderInfo) msgContext.getProperty(
+                            TRANSPORT_SENDER_INFO);
+            InputStream in = null;
+            if (chuncked || msgContext.isDoingMTOM()) {
+                if (chuncked) {
+                    ((ChunkedOutputStream) out).eos();
+                    in = new ChunkedInputStream(transportInfo.in);
+                }
+                in = transportInfo.in;
+            } else {
+                openSocket(msgContext);
+                OutputStream outS = transportInfo.out;
+                in = transportInfo.in;
+                byte[] bytes = transportInfo.outputStream.toByteArray();
+
+                //write header to the out put stream
+                writeTransportHeaders(outS,
+                        transportInfo.url,
+                        msgContext,
+                        bytes.length);
+                outS.flush();
+                //write the content to the real output stream
+                outS.write(bytes);
+            }
+
+            transportInfo.socket.shutdownOutput();
+            HTTPTransportReceiver tr = new HTTPTransportReceiver();
+            Map map = tr.parseTheHeaders(transportInfo.in, false);
+            if (!HTTPConstants
+                    .RESPONSE_ACK_CODE_VAL
+                    .equals(map.get(HTTPConstants.RESPONSE_CODE))) {
+                String transferEncoding =
+                        (String) map.get(
+                                HTTPConstants.HEADER_TRANSFER_ENCODING);
+                if (transferEncoding != null
+                        &&
+                        HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(
+                                transferEncoding)) {
+                    in = new ChunkedInputStream(transportInfo.in);
+                }
+                msgContext.setProperty(MessageContext.TRANSPORT_IN, in);
+
+                String contentType = (String) map.get(
+                        HTTPConstants.HEADER_CONTENT_TYPE);
+                if (contentType != null &&
+                        contentType.indexOf(
+                                HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >=
+                        0) {
+                    OperationContext opContext = msgContext.getOperationContext();
+                    if (opContext != null) {
+                        opContext.setProperty(
+                                HTTPConstants.MTOM_RECIVED_CONTENT_TYPE,
+                                contentType);
+                    }
+                }
+            }
+        } catch (IOException e) {
+            throw new AxisFault(e);
+        }
+
+    }
+
+    protected OutputStream openTheConnection(EndpointReference epr,
+                                             MessageContext msgctx)
+            throws AxisFault {
+        msgctx.setProperty(TRANSPORT_SENDER_INFO, new TransportSenderInfo());
+
+        if (msgctx.isDoingMTOM() || chuncked) {
+            return openSocket(msgctx);
+        } else {
+            TransportSenderInfo transportInfo =
+                    (TransportSenderInfo) msgctx.getProperty(
+                            TRANSPORT_SENDER_INFO);
+            transportInfo.outputStream = new ByteArrayOutputStream();
+            return transportInfo.outputStream;
+        }
+    }
+
+    public OutputStream startSendWithOutputStreamFromIncomingConnection(
+            MessageContext msgContext,
+            OutputStream out)
+            throws AxisFault {
+        if (msgContext.isDoingMTOM()) {
+            HTTPOutTransportInfo httpOutTransportInfo = (HTTPOutTransportInfo) msgContext.getProperty(
+                    HTTPConstants.HTTPOutTransportInfo);
+            if (httpOutTransportInfo != null) {
+                httpOutTransportInfo.setContentType(
+                        OMOutputImpl.getContentType(true));
+            } else {
+                throw new AxisFault(
+                        "Property " + HTTPConstants.HTTPOutTransportInfo +
+                        " not set by the Server");
+            }
+
+        }
+        return out;
+    }
+
+    public OutputStream startSendWithToAddress(MessageContext msgContext,
+                                               OutputStream out)
+            throws AxisFault {
+        try {
+            if (msgContext.isDoingMTOM() || chuncked) {
+                TransportSenderInfo transportInfo =
+                        (TransportSenderInfo) msgContext.getProperty(
+                                TRANSPORT_SENDER_INFO);
+                writeTransportHeaders(out, transportInfo.url, msgContext, -1);
+                out.flush();
+                if (chuncked) {
+                    return new ChunkedOutputStream(out);
+                } else {
+                    return out;
+                }
+            } else {
+                return out;
+            }
+        } catch (IOException e) {
+            throw new AxisFault(e);
+        }
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.axis2.transport.TransportSender#cleanUp()
+     */
+    public void cleanUp(MessageContext msgContext) throws AxisFault {
+        TransportSenderInfo transportInfo =
+                (TransportSenderInfo) msgContext.getProperty(
+                        TRANSPORT_SENDER_INFO);
+        try {
+            if (transportInfo.socket != null) {
+                transportInfo.socket.close();
+            }
+
+        } catch (IOException e) {
+        }
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.axis2.transport.TransportSender#init(org.apache.axis2.context.ConfigurationContext, org.apache.axis2.description.TransportOutDescription)
+     */
+    public void init(ConfigurationContext confContext,
+                     TransportOutDescription transportOut)
+            throws AxisFault {
+        //<parameter name="PROTOCOL" locked="xsd:false">HTTP/1.0</parameter> or 
+        //<parameter name="PROTOCOL" locked="xsd:false">HTTP/1.1</parameter> is checked
+        Parameter version =
+                transportOut.getParameter(HTTPConstants.PROTOCOL_VERSION);
+        if (version != null) {
+            if (HTTPConstants.HEADER_PROTOCOL_11.equals(version.getValue())) {
+                this.httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
+                Parameter transferEncoding =
+                        transportOut.getParameter(
+                                HTTPConstants.HEADER_TRANSFER_ENCODING);
+                if (transferEncoding != null
+                        &&
+                        HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(
+                                transferEncoding.getValue())) {
+                    this.chuncked = true;
+                }
+            } else if (
+                    HTTPConstants.HEADER_PROTOCOL_10.equals(version.getValue())) {
+                //TODO HTTP1.0 specific parameters
+            } else {
+                throw new AxisFault(
+                        "Parameter "
+                        + HTTPConstants.PROTOCOL_VERSION
+                        + " Can have values only HTTP/1.0 or HTTP/1.1");
+            }
+        }
+
+    }
+
+    private class TransportSenderInfo {
+        public InputStream in;
+        public OutputStream out;
+        public ByteArrayOutputStream outputStream;
+        public URL url;
+        public Socket socket;
+    }
+
+}