axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sami...@apache.org
Subject svn commit: r356596 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http: AbstractHTTPSender.java SOAPOverHTTPSender.java
Date Tue, 13 Dec 2005 19:58:51 GMT
Author: saminda
Date: Tue Dec 13 11:58:50 2005
New Revision: 356596

URL: http://svn.apache.org/viewcvs?rev=356596&view=rev
Log:
TransportSenders have been updated to handle runtime proxy setting 
correctly. A bug in the system has been fixed. Now we have complete 
proxy support :). Test case is added 

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java?rev=356596&r1=356595&r2=356596&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
Tue Dec 13 11:58:50 2005
@@ -35,374 +35,386 @@
 
 
 public abstract class AbstractHTTPSender {
-	protected boolean chuncked = false;
+    protected boolean chuncked = false;
 
-	protected String httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
+    protected String httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
 
-	protected Log log = LogFactory.getLog(getClass().getName());
+    protected Log log = LogFactory.getLog(getClass().getName());
 
-	protected HttpClient httpClient;
+    protected HttpClient httpClient;
 
-	int soTimeout = HTTPConstants.DEFAULT_SO_TIMEOUT;
+    int soTimeout = HTTPConstants.DEFAULT_SO_TIMEOUT;
 
-	int connectionTimeout = HTTPConstants.DEFAULT_CONNECTION_TIMEOUT;
+    int connectionTimeout = HTTPConstants.DEFAULT_CONNECTION_TIMEOUT;
 
-	protected static final String ANONYMOUS = "anonymous";
+    protected static final String ANONYMOUS = "anonymous";
 
-	protected OMOutputFormat format = new OMOutputFormat();
+    protected OMOutputFormat format = new OMOutputFormat();
 
-	/**
-	 * proxydiscription
-	 */
-	protected TransportOutDescription proxyOutSetting = null;
+    /**
+     * proxydiscription
+     */
+    protected TransportOutDescription proxyOutSetting = null;
 
-	protected static final String PROXY_HOST_NAME = "proxy_host";
+    protected static final String PROXY_HOST_NAME = "proxy_host";
 
-	protected static final String PROXY_PORT = "proxy_port";
+    protected static final String PROXY_PORT = "proxy_port";
 
     public void setFormat(OMOutputFormat format) {
         this.format = format;
     }
 
     public abstract void send(MessageContext msgContext,
-                              OMElement dataout, URL url, String soapActionString)
-			throws MalformedURLException, AxisFault, IOException;
+                              OMElement dataout, URL url,
+                              String soapActionString)
+            throws MalformedURLException, AxisFault, IOException;
+
+    /**
+     * This is used to get the dynamically set time out values from the
+     * message context. If the values are not available or invalid then
+     * teh default values or the values set by teh configuration will be used
+     *
+     * @param msgContext
+     */
+    protected void getTimeoutValues(MessageContext msgContext) {
+        try {
+            // If the SO_TIMEOUT of CONNECTION_TIMEOUT is set by dynamically the
+            // override the static config
+            Integer tempSoTimeoutProperty = (Integer) msgContext
+                    .getProperty(HTTPConstants.SO_TIMEOUT);
+            Integer tempConnTimeoutProperty = (Integer) msgContext
+                    .getProperty(HTTPConstants.CONNECTION_TIMEOUT);
+
+            if (tempSoTimeoutProperty != null) {
+                soTimeout = tempSoTimeoutProperty.intValue();
+            }
+
+            if (tempConnTimeoutProperty != null) {
+                connectionTimeout = tempConnTimeoutProperty.intValue();
+            }
+        } catch (NumberFormatException nfe) {
+            //If there's a problem log it and use the default values
+            log.error("Invalid timeout value format: not a number", nfe);
+        }
+    }
+
+    /**
+     * getting host configuration to support standard http/s, proxy and NTLM support
+     */
+    protected HostConfiguration getHostConfiguration(HttpClient client,
+                                                     MessageContext msgCtx,
+                                                     URL targetURL)
+            throws AxisFault {
+        boolean isHostProxy = isProxyListed(msgCtx); //list the proxy
+        int port = targetURL.getPort();
+        if (port == -1)
+            port = 80;
+        // to see the host is a proxy and in the proxy list - available in axis2.xml
+        HostConfiguration config = new HostConfiguration();
+
+        if (!isHostProxy) {
+            config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
+        } else {
+            //proxy and NTLM configuration
+            this.configProxyAuthentication(client, proxyOutSetting, config,
+                    msgCtx);
+        }
+        return config;
+    }
 
-	/**
-	 * This is used to get the dynamically set time out values from the
-	 * message context. If the values are not available or invalid then
-	 * teh default values or the values set by teh configuration will be used
-	 *
-	 * @param msgContext
-	 */
-	protected void getTimeoutValues(MessageContext msgContext) {
-		try {
-			// If the SO_TIMEOUT of CONNECTION_TIMEOUT is set by dynamically the
-			// override the static config
-			Integer tempSoTimeoutProperty = (Integer) msgContext
-					.getProperty(HTTPConstants.SO_TIMEOUT);
-			Integer tempConnTimeoutProperty = (Integer) msgContext
-					.getProperty(HTTPConstants.CONNECTION_TIMEOUT);
-
-			if (tempSoTimeoutProperty != null) {
-				soTimeout = tempSoTimeoutProperty.intValue();
-			}
-
-			if (tempConnTimeoutProperty != null) {
-				connectionTimeout = tempConnTimeoutProperty.intValue();
-			}
-		} catch (NumberFormatException nfe) {
-			//If there's a problem log it and use the default values
-			log.error("Invalid timeout value format: not a number", nfe);
-		}
-	}
-
-	/**
-	 * getting host configuration to support standard http/s, proxy and NTLM support
-	 */
-	protected HostConfiguration getHostConfiguration(HttpClient client,
-			MessageContext msgCtx, URL targetURL) throws AxisFault {
-		boolean isHostProxy = isProxyListed(msgCtx); //list the proxy
-		int port = targetURL.getPort();
-		if (port == -1)
-			port = 80;
-		// to see the host is a proxy and in the proxy list - available in axis2.xml
-		HostConfiguration config = new HostConfiguration();
-
-		if (!isHostProxy) {
-			config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
-		} else {
-			//proxy and NTLM configuration
-			this.configProxyAuthentication(client, proxyOutSetting, config,
-					msgCtx);
-		}
-		return config;
-	}
-
-	/**
-	 * Helper method to Proxy and NTLM authentication
-	 *
-	 * @param client
-	 * @param proxySetting
-	 * @param config
-	 */
-
-	protected void configProxyAuthentication(HttpClient client,
-			TransportOutDescription proxySetting, HostConfiguration config,
-			MessageContext msgCtx) throws AxisFault {
-		Parameter proxyParam = proxySetting.getParameter(HTTPConstants.PROXY);
-		String value = (String) proxyParam.getValue();
-		String split[] = value.split(":");
-        
-        //values being hard coded due best practise
-		String usrName = split[0];
-		String domain = split[1];
-		String passwd = split[2];
-		//
-		Credentials proxyCred ;
-
-		String proxyHostName = null;
-		int proxyPort = -1;
-
-		if (proxyParam != null) {
-			OMElement proxyParamElement = proxyParam.getParameterElement();
-			Iterator ite = proxyParamElement.getAllAttributes();
-			while (ite.hasNext()) {
-				OMAttribute att = (OMAttribute) ite.next();
-				if (att.getLocalName().equalsIgnoreCase(PROXY_HOST_NAME)) {
-					proxyHostName = att.getAttributeValue();
-				}
-				if (att.getLocalName().equalsIgnoreCase(PROXY_PORT)) {
-					proxyPort = Integer.parseInt(att.getAttributeValue());
-				}
-			}
-		}
-
-		if (domain.equals("") || domain.equals(ANONYMOUS)) {
-			if (usrName.equals(ANONYMOUS) && passwd.equals(ANONYMOUS)) {
-				proxyCred = new UsernamePasswordCredentials("", "");
-			} else {
-				proxyCred = new UsernamePasswordCredentials(usrName, passwd); //proxy
-			}
-		} else {
-			proxyCred = new NTCredentials(usrName, passwd, proxyHostName,
-					domain); //NTLM authentication with additionals prams
-		}
-
-		HttpTransportProperties.ProxyProperties proxyProperties = (HttpTransportProperties.ProxyProperties)
msgCtx
-				.getProperty(HTTPConstants.PROXY);
-		if (proxyProperties != null) {
-			if (proxyProperties.getProxyPort() != -1) {
-				proxyPort = proxyProperties.getProxyPort();
-			}
-			if (proxyProperties.getProxyHostName().equals("")
-					|| proxyProperties.getProxyHostName() != null) {
-				proxyHostName = proxyProperties.getProxyHostName();
-			} else {
-				throw new AxisFault("Proxy Name is not valied");
-			}
-			if (proxyProperties.getUserName().equals(ANONYMOUS)
-					|| proxyProperties.getPassWord().equals(ANONYMOUS)) {
-				proxyCred = new UsernamePasswordCredentials("", "");
-			}
-		}
-		client.getState().setProxyCredentials(AuthScope.ANY, proxyCred);
-		config.setProxy(proxyHostName, proxyPort);
-	}
-
-	private boolean isProxyListed(MessageContext msgCtx) throws AxisFault {
-		boolean returnValue = false;
-		Parameter par = null;
-		proxyOutSetting = msgCtx.getConfigurationContext().getAxisConfiguration()
-				.getTransportOut(new QName(Constants.TRANSPORT_HTTP));
-		if (proxyOutSetting != null) {
-			par = proxyOutSetting.getParameter(HTTPConstants.PROXY);
-		}
-		OMElement hostElement;
-		if (par != null) {
-			hostElement = par.getParameterElement();
-		} else {
-			return returnValue;
-		}
-
-		if (hostElement != null) {
-			Iterator ite = hostElement.getAllAttributes();
-			while (ite.hasNext()) {
-				OMAttribute attribute = (OMAttribute) ite.next();
-				if (attribute.getLocalName().equalsIgnoreCase(PROXY_HOST_NAME)) {
-					returnValue = true;
-				}
-			}
-		}
+    /**
+     * Helper method to Proxy and NTLM authentication
+     *
+     * @param client
+     * @param proxySetting
+     * @param config
+     */
+
+    protected void configProxyAuthentication(HttpClient client,
+                                             TransportOutDescription proxySetting,
+                                             HostConfiguration config,
+                                             MessageContext msgCtx)
+            throws AxisFault {
+        Parameter proxyParam = proxySetting.getParameter(HTTPConstants.PROXY);
+        String usrName = null;
+        String domain = null;
+        String passwd = null;
+        Credentials proxyCred = null;
+
+        String proxyHostName = null;
+        int proxyPort = -1;
+        if (proxyParam != null) {
+            String value = (String) proxyParam.getValue();
+            String split[] = value.split(":");
+
+            //values being hard coded due best practise
+            usrName = split[0];
+            domain = split[1];
+            passwd = split[2];
+            //
+
+            OMElement proxyParamElement = proxyParam.getParameterElement();
+            Iterator ite = proxyParamElement.getAllAttributes();
+            while (ite.hasNext()) {
+                OMAttribute att = (OMAttribute) ite.next();
+                if (att.getLocalName().equalsIgnoreCase(PROXY_HOST_NAME)) {
+                    proxyHostName = att.getAttributeValue();
+                }
+                if (att.getLocalName().equalsIgnoreCase(PROXY_PORT)) {
+                    proxyPort = Integer.parseInt(att.getAttributeValue());
+                }
+            }
+
+
+            if (domain.equals("") || domain.equals(ANONYMOUS)) {
+                if (usrName.equals(ANONYMOUS) && passwd.equals(ANONYMOUS)) {
+                    proxyCred = new UsernamePasswordCredentials("", "");
+                } else {
+                    proxyCred = new UsernamePasswordCredentials(usrName,
+                            passwd); //proxy
+                }
+            } else {
+                proxyCred = new NTCredentials(usrName, passwd, proxyHostName,
+                        domain); //NTLM authentication with additionals prams
+            }
+        }
+
+        HttpTransportProperties.ProxyProperties proxyProperties =
+                (HttpTransportProperties.ProxyProperties) msgCtx
+                        .getProperty(HTTPConstants.PROXY);
+        if (proxyProperties != null) {
+            if (proxyProperties.getProxyPort() != -1) {
+                proxyPort = proxyProperties.getProxyPort();
+            }
+            if (!proxyProperties.getProxyHostName().equals("")
+                    || proxyProperties.getProxyHostName() != null) {
+                proxyHostName = proxyProperties.getProxyHostName();
+            } else {
+                throw new AxisFault("Proxy Name is not valid");
+            }
+            if (proxyProperties.getUserName().equals(ANONYMOUS)
+                    || proxyProperties.getPassWord().equals(ANONYMOUS)) {
+                proxyCred = new UsernamePasswordCredentials("", "");
+            }
+        }
+        client.getState().setProxyCredentials(AuthScope.ANY, proxyCred);
+        config.setProxy(proxyHostName, proxyPort);
+    }
+
+    private boolean isProxyListed(MessageContext msgCtx) throws AxisFault {
+        boolean returnValue = false;
+        Parameter par = null;
+        proxyOutSetting =
+                msgCtx.getConfigurationContext().getAxisConfiguration()
+                        .getTransportOut(new QName(Constants.TRANSPORT_HTTP));
+        if (proxyOutSetting != null) {
+            par = proxyOutSetting.getParameter(HTTPConstants.PROXY);
+        }
+        OMElement hostElement = null;
+        if (par != null) {
+            hostElement = par.getParameterElement();
+        }
+
+        if (hostElement != null) {
+            Iterator ite = hostElement.getAllAttributes();
+            while (ite.hasNext()) {
+                OMAttribute attribute = (OMAttribute) ite.next();
+                if (attribute.getLocalName().equalsIgnoreCase(PROXY_HOST_NAME))
+                {
+                    returnValue = true;
+                }
+            }
+        }
 
         HttpTransportProperties.ProxyProperties proxyProperties;
-		if ((proxyProperties = (HttpTransportProperties.ProxyProperties) msgCtx
-				.getProperty(HTTPConstants.PROXY)) != null) {
-			if (proxyProperties.getProxyHostName() != null) {
-				returnValue = true;
-			}
-		}
-		return returnValue;
-	}
-
-	/**
-	 * Collect the HTTP header information and set them in the message context
-	 *
-	 * @param method
-	 * @param msgContext
-	 */
-	protected void obatainHTTPHeaderInformation(HttpMethodBase method,
-			MessageContext msgContext) {
-		Header header = method
-				.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
-		if (header != null) {
-			HeaderElement[] headers = header.getElements();
-			for (int i = 0; i < headers.length; i++) {
-				NameValuePair charsetEnc = headers[i]
-						.getParameterByName(HTTPConstants.CHAR_SET_ENCODING);
-				if (headers[i].getName().equalsIgnoreCase(
-						HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED)) {
-					OperationContext opContext = msgContext
-							.getOperationContext();
-					if (opContext != null) {
-						opContext.setProperty(
-								HTTPConstants.MTOM_RECIVED_CONTENT_TYPE, header
-										.getValue());
-					}
-				} else if (charsetEnc != null) {
-
-					msgContext.setProperty(
-							MessageContext.CHARACTER_SET_ENCODING, charsetEnc
-									.getValue()); //change to the value, which is text/xml or application/xml+soap
-				}
-			}
-		}
-	}
-
-	protected void processResponse(HttpMethodBase httpMethod,
-			MessageContext msgContext) throws IOException {
-		obatainHTTPHeaderInformation(httpMethod, msgContext);
-		InputStream in = httpMethod.getResponseBodyAsStream();
-		if (in == null) {
-			throw new AxisFault(Messages.getMessage("canNotBeNull",
-					"InputStream"));
-		}
-		msgContext.getOperationContext().setProperty(
-				MessageContext.TRANSPORT_IN, in);
-	}
-
-	public class AxisRequestEntity implements RequestEntity {
-
-		private String charSetEnc;
-
-		private OMElement element;
-
-		private boolean chuncked;
-
-		private byte[] bytes;
-
-		private boolean doingMTOM = false;
-
-		private String soapActionString;
-
-		private MessageContext msgCtxt;
-
-		public AxisRequestEntity(OMElement element, boolean chuncked,
-				MessageContext msgCtxt, String charSetEncoding,
-				String soapActionString) {
-			this.element = element;
-			this.chuncked = chuncked;
-			this.msgCtxt = msgCtxt;
-			this.doingMTOM = msgCtxt.isDoingMTOM();
-			this.charSetEnc = charSetEncoding;
-			this.soapActionString = soapActionString;
-		}
-
-		public boolean isRepeatable() {
-			return true;
-		}
-
-		public byte[] writeBytes() throws AxisFault {
-			try {
-				ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
+        if ((proxyProperties = (HttpTransportProperties.ProxyProperties) msgCtx
+                .getProperty(HTTPConstants.PROXY)) != null) {
+            if (proxyProperties.getProxyHostName() != null) {
+                returnValue = true;
+            }
+        }
+        return returnValue;
+    }
+
+    /**
+     * Collect the HTTP header information and set them in the message context
+     *
+     * @param method
+     * @param msgContext
+     */
+    protected void obatainHTTPHeaderInformation(HttpMethodBase method,
+                                                MessageContext msgContext) {
+        Header header = method
+                .getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+        if (header != null) {
+            HeaderElement[] headers = header.getElements();
+            for (int i = 0; i < headers.length; i++) {
+                NameValuePair charsetEnc = headers[i]
+                        .getParameterByName(HTTPConstants.CHAR_SET_ENCODING);
+                if (headers[i].getName().equalsIgnoreCase(
+                        HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED)) {
+                    OperationContext opContext = msgContext
+                            .getOperationContext();
+                    if (opContext != null) {
+                        opContext.setProperty(
+                                HTTPConstants.MTOM_RECIVED_CONTENT_TYPE, header
+                                .getValue());
+                    }
+                } else if (charsetEnc != null) {
+
+                    msgContext.setProperty(
+                            MessageContext.CHARACTER_SET_ENCODING, charsetEnc
+                            .getValue()); //change to the value, which is text/xml or application/xml+soap
+                }
+            }
+        }
+    }
+
+    protected void processResponse(HttpMethodBase httpMethod,
+                                   MessageContext msgContext)
+            throws IOException {
+        obatainHTTPHeaderInformation(httpMethod, msgContext);
+        InputStream in = httpMethod.getResponseBodyAsStream();
+        if (in == null) {
+            throw new AxisFault(Messages.getMessage("canNotBeNull",
+                    "InputStream"));
+        }
+        msgContext.getOperationContext().setProperty(
+                MessageContext.TRANSPORT_IN, in);
+    }
+
+    public class AxisRequestEntity implements RequestEntity {
 
-				if (!doingMTOM) {
-					OMOutputFormat format2 = new OMOutputFormat();
+        private String charSetEnc;
+
+        private OMElement element;
+
+        private boolean chuncked;
+
+        private byte[] bytes;
+
+        private boolean doingMTOM = false;
+
+        private String soapActionString;
+
+        private MessageContext msgCtxt;
+
+        public AxisRequestEntity(OMElement element, boolean chuncked,
+                                 MessageContext msgCtxt, String charSetEncoding,
+                                 String soapActionString) {
+            this.element = element;
+            this.chuncked = chuncked;
+            this.msgCtxt = msgCtxt;
+            this.doingMTOM = msgCtxt.isDoingMTOM();
+            this.charSetEnc = charSetEncoding;
+            this.soapActionString = soapActionString;
+        }
+
+        public boolean isRepeatable() {
+            return true;
+        }
+
+        public byte[] writeBytes() throws AxisFault {
+            try {
+                ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
+
+                if (!doingMTOM) {
+                    OMOutputFormat format2 = new OMOutputFormat();
                     format2.setCharSetEncoding(charSetEnc);
                     element.serializeAndConsume(bytesOut, format2);
                     return bytesOut.toByteArray();
 
-				} else {
-					format.setCharSetEncoding(charSetEnc);
+                } else {
+                    format.setCharSetEncoding(charSetEnc);
                     format.setDoOptimize(true);
                     element.serializeAndConsume(bytesOut, format);
                     return bytesOut.toByteArray();
-				}
-			} catch (XMLStreamException e) {
-				throw new AxisFault(e);
-			} catch (FactoryConfigurationError e) {
-				throw new AxisFault(e);
-			}
-		}
-
-		private void handleOMOutput(OutputStream out, boolean doingMTOM)
-				throws XMLStreamException {
-			format.setDoOptimize(doingMTOM);
+                }
+            } catch (XMLStreamException e) {
+                throw new AxisFault(e);
+            } catch (FactoryConfigurationError e) {
+                throw new AxisFault(e);
+            }
+        }
+
+        private void handleOMOutput(OutputStream out, boolean doingMTOM)
+                throws XMLStreamException {
+            format.setDoOptimize(doingMTOM);
             element.serializeAndConsume(out, format);
-		}
+        }
 
-		public void writeRequest(OutputStream out) throws IOException {
-			try {
-				if (doingMTOM) { //chagened ..
-					if (chuncked) {
-						this.handleOMOutput(out, doingMTOM);
-					} else {
-						if (bytes == null) {
-							bytes = writeBytes();
-						}
-						out.write(bytes);
-					}
-
-				} else {
-					if (chuncked) {
-						this.handleOMOutput(out, doingMTOM);
-					} else {
-						if (bytes == null) {
-							bytes = writeBytes();
-						}
-						out.write(bytes);
-					}
-				}
-				out.flush();
-			} 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 (doingMTOM) { //chagened
-					if (chuncked) {
-						return -1;
-					} else {
-						if (bytes == null) {
-							bytes = writeBytes();
-						}
-						return bytes.length;
-					}
-				} else {
-					if (chuncked) {
-						return -1;
-					} else {
-						if (bytes == null) {
-							bytes = writeBytes();
-						}
-						return bytes.length;
-					}
-				}
-			} catch (AxisFault e) {
-				return -1;
-			}
-		}
+        public void writeRequest(OutputStream out) throws IOException {
+            try {
+                if (doingMTOM) { //chagened ..
+                    if (chuncked) {
+                        this.handleOMOutput(out, doingMTOM);
+                    } else {
+                        if (bytes == null) {
+                            bytes = writeBytes();
+                        }
+                        out.write(bytes);
+                    }
+
+                } else {
+                    if (chuncked) {
+                        this.handleOMOutput(out, doingMTOM);
+                    } else {
+                        if (bytes == null) {
+                            bytes = writeBytes();
+                        }
+                        out.write(bytes);
+                    }
+                }
+                out.flush();
+            } 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 (doingMTOM) { //chagened
+                    if (chuncked) {
+                        return -1;
+                    } else {
+                        if (bytes == null) {
+                            bytes = writeBytes();
+                        }
+                        return bytes.length;
+                    }
+                } else {
+                    if (chuncked) {
+                        return -1;
+                    } else {
+                        if (bytes == null) {
+                            bytes = writeBytes();
+                        }
+                        return bytes.length;
+                    }
+                }
+            } catch (AxisFault e) {
+                return -1;
+            }
+        }
 
-		public String getContentType() {
-			String encoding = format.getCharSetEncoding();
+        public String getContentType() {
+            String encoding = format.getCharSetEncoding();
             String contentType = format.getContentType();
-			if (encoding != null) {
-				contentType += "; charset=" + encoding;
-			}
-
-			// action header is not mandated in SOAP 1.2. So putting it, if available
-			if (!msgCtxt.isSOAP11() && soapActionString != null
-					&& !"".equals(soapActionString.trim())) {
-				contentType = contentType + ";action=\"" + soapActionString
-						+ "\";";
-			}
-			return contentType;
-		}
-	}
+            if (encoding != null) {
+                contentType += "; charset=" + encoding;
+            }
+
+            // action header is not mandated in SOAP 1.2. So putting it, if available
+            if (!msgCtxt.isSOAP11() && soapActionString != null
+                    && !"".equals(soapActionString.trim())) {
+                contentType = contentType + ";action=\"" + soapActionString
+                        + "\";";
+            }
+            return contentType;
+        }
+    }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java?rev=356596&r1=356595&r2=356596&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
Tue Dec 13 11:58:50 2005
@@ -52,7 +52,6 @@
         httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(
                 connectionTimeout);
 
-        //todo giving proxy and NTLM support
 
 
         PostMethod postMethod = new PostMethod(url.toString());



Mime
View raw message