You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2006/07/17 09:57:59 UTC

svn commit: r422650 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http: AbstractHTTPSender.java CommonsHTTPTransportSender.java HTTPConstants.java RESTSender.java SOAPOverHTTPSender.java

Author: chinthaka
Date: Mon Jul 17 00:57:37 2006
New Revision: 422650

URL: http://svn.apache.org/viewvc?rev=422650&view=rev
Log:
- making SOAPAction a quoted string as per http://issues.apache.org/jira/browse/AXIS2-894
- making user to set custom SOAP headers as per http://issues.apache.org/jira/browse/AXIS2-899

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/CommonsHTTPTransportSender.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/RESTSender.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/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java?rev=422650&r1=422649&r2=422650&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 Mon Jul 17 00:57:37 2006
@@ -21,23 +21,23 @@
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.util.Utils;
 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.i18n.Messages;
+import org.apache.axis2.util.Utils;
 import org.apache.commons.httpclient.Credentials;
 import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HeaderElement;
 import org.apache.commons.httpclient.HostConfiguration;
 import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
 import org.apache.commons.httpclient.NTCredentials;
 import org.apache.commons.httpclient.NameValuePair;
 import org.apache.commons.httpclient.UsernamePasswordCredentials;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
-import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.auth.AuthScope;
 import org.apache.commons.httpclient.methods.RequestEntity;
 import org.apache.commons.logging.Log;
@@ -52,6 +52,7 @@
 import java.io.OutputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.zip.GZIPInputStream;
 
@@ -61,7 +62,7 @@
     protected static final String PROXY_PORT = "proxy_port";
     protected boolean chunked = false;
     protected String httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
-	private static final Log log = LogFactory.getLog(AbstractHTTPSender.class);
+    private static final Log log = LogFactory.getLog(AbstractHTTPSender.class);
     int soTimeout = HTTPConstants.DEFAULT_SO_TIMEOUT;
 
     /**
@@ -79,8 +80,7 @@
         if (version != null) {
             if (HTTPConstants.HEADER_PROTOCOL_11.equals(version)) {
                 this.httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
-            } else
-            if (HTTPConstants.HEADER_PROTOCOL_10.equals(version)) {
+            } else if (HTTPConstants.HEADER_PROTOCOL_10.equals(version)) {
                 this.httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
                 // chunked is not possible with HTTP/1.0
                 this.chunked = false;
@@ -228,7 +228,7 @@
                 }
             }
         }
-        
+
         String sessionCookie = null;
         // Process old style headers first
         Header[] cookieHeaders = method.getResponseHeaders(HTTPConstants.HEADER_SET_COOKIE);
@@ -255,7 +255,7 @@
 
         if (sessionCookie != null) {
             msgContext.getServiceContext().setProperty(Constants.COOKIE_STRING, sessionCookie);
-        }        
+        }
     }
 
     protected void processResponse(HttpMethodBase httpMethod,
@@ -266,12 +266,12 @@
         InputStream in = httpMethod.getResponseBodyAsStream();
 
         Header contentEncoding =
-            httpMethod.getResponseHeader(HTTPConstants.HEADER_CONTENT_ENCODING);
+                httpMethod.getResponseHeader(HTTPConstants.HEADER_CONTENT_ENCODING);
         if (contentEncoding != null) {
             if (contentEncoding.getValue().
                     equalsIgnoreCase(HTTPConstants.COMPRESSION_GZIP)) {
                 in =
-                    new GZIPInputStream(in);
+                        new GZIPInputStream(in);
             } else {
                 throw new AxisFault("HTTP :"
                         + "unsupported content-encoding of '"
@@ -285,7 +285,7 @@
                     Messages.getMessage("canNotBeNull", "InputStream"));
         }
 
-        if(msgContext.getOperationContext() != null) {
+        if (msgContext.getOperationContext() != null) {
             msgContext.getOperationContext()
                     .setProperty(MessageContext.TRANSPORT_IN, in);
         }
@@ -317,9 +317,9 @@
 
         if (!isHostProxy && !authenticationEnabled) {
             config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
-        }else if(authenticationEnabled){
-             // premtive authentication Basic or NTLM
-            this.configServerPreemtiveAuthenticaiton(client,msgCtx,config,targetURL);
+        } else if (authenticationEnabled) {
+            // premtive authentication Basic or NTLM
+            this.configServerPreemtiveAuthenticaiton(client, msgCtx, config, targetURL);
         } else {
 
             // proxy configuration
@@ -364,7 +364,7 @@
                                                      HostConfiguration config,
                                                      URL targetURL) {
         config.setHost(targetURL.getHost(), targetURL.getPort(),
-                       targetURL.getProtocol());
+                targetURL.getProtocol());
 
         agent.getParams().setAuthenticationPreemptive(true);
 
@@ -383,7 +383,7 @@
                     basicAuthentication.getUsername(),
                     basicAuthentication.getPassword());
             if (basicAuthentication.getPort() == -1 ||
-                basicAuthentication.getHost() == null) {
+                    basicAuthentication.getHost() == null) {
 
                 agent.getState()
                         .setCredentials(AuthScope.ANY, defaultCredentials);
@@ -399,7 +399,7 @@
                             basicAuthentication.getHost(),
                             basicAuthentication.getPort(),
                             basicAuthentication.getRealm()),
-                                                    defaultCredentials);
+                            defaultCredentials);
                 }
             }
         }
@@ -444,7 +444,7 @@
     private boolean serverPreemtiveAuthentication(MessageContext msgContext) {
 
         return (msgContext.getProperty(HTTPConstants.BASIC_AUTHENTICATION) !=
-               null || msgContext.getProperty(HTTPConstants.NTLM_AUTHENTICATION) != null);
+                null || msgContext.getProperty(HTTPConstants.NTLM_AUTHENTICATION) != null);
     }
 
     private boolean isProxyListed(MessageContext msgCtx) throws AxisFault {
@@ -471,8 +471,7 @@
             while (ite.hasNext()) {
                 OMAttribute attribute = (OMAttribute) ite.next();
 
-                if (attribute.getLocalName().equalsIgnoreCase(PROXY_HOST_NAME))
-                {
+                if (attribute.getLocalName().equalsIgnoreCase(PROXY_HOST_NAME)) {
                     returnValue = true;
                 }
             }
@@ -615,9 +614,9 @@
     protected HttpClient getHttpClient(MessageContext msgContext) {
         HttpClient httpClient = null;
         Boolean reuse = (Boolean) msgContext.getOptions().getProperty(HTTPConstants.REUSE_HTTP_CLIENT);
-        if(reuse != null && reuse.booleanValue()) {
+        if (reuse != null && reuse.booleanValue()) {
             httpClient = (HttpClient) msgContext.getConfigurationContext().getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
-            if(httpClient == null){
+            if (httpClient == null) {
                 MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
                 httpClient = new HttpClient(connectionManager);
                 msgContext.getConfigurationContext().setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
@@ -641,6 +640,10 @@
         HostConfiguration config = this.getHostConfiguration(httpClient, msgContext, url);
         msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
 
+
+        // set the custom headers, if available
+        addCustomHeaders(method, msgContext);
+
         // add compression headers if needed
         if (Utils.isExplicitlyTrue(msgContext, HTTPConstants.MC_ACCEPT_GZIP)) {
             method.addRequestHeader(HTTPConstants.HEADER_ACCEPT_ENCODING,
@@ -651,6 +654,56 @@
                     HTTPConstants.COMPRESSION_GZIP);
         }
 
+
+
         httpClient.executeMethod(config, method);
+    }
+
+    public void addCustomHeaders(HttpMethod method, MessageContext msgContext) {
+
+        boolean isCustomUserAgentSet = false;
+        // set the custom headers, if available
+        Object httpHeadersObj = msgContext.getProperty(HTTPConstants.HTTP_HEADERS);
+        if (httpHeadersObj != null && httpHeadersObj instanceof ArrayList) {
+            ArrayList httpHeaders = (ArrayList) httpHeadersObj;
+            Header header;
+            for (int i = 0; i < httpHeaders.size(); i++) {
+                header = (Header) httpHeaders.get(i);
+                if (HTTPConstants.HEADER_USER_AGENT.equals(header.getName())) {
+                    isCustomUserAgentSet = true;
+                }
+                method.addRequestHeader((Header) header);
+            }
+
+        }
+
+        if (!isCustomUserAgentSet) {
+            String userAgentString = getUserAgent(msgContext);
+            method.setRequestHeader(HTTPConstants.HEADER_USER_AGENT, userAgentString);
+        }
+
+    }
+
+    private String getUserAgent(MessageContext messageContext) {
+        String userAgentString = "Axis2";
+        boolean locked = false;
+        if (messageContext.getParameter(HTTPConstants.USER_AGENT) != null) {
+            OMElement userAgentElement = messageContext.getParameter(HTTPConstants.USER_AGENT).getParameterElement();
+            userAgentString = userAgentElement.getText().trim();
+            OMAttribute lockedAttribute = userAgentElement.getAttribute(new QName("locked"));
+            if (lockedAttribute != null) {
+                if (lockedAttribute.getAttributeValue().equalsIgnoreCase("true")) {
+                    locked = true;
+                }
+            }
+        }
+        // Runtime overing part
+        if (!locked) {
+            if (messageContext.getProperty(HTTPConstants.USER_AGENT) != null) {
+                userAgentString = (String) messageContext.getProperty(HTTPConstants.USER_AGENT);
+            }
+        }
+
+        return userAgentString;
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?rev=422650&r1=422649&r2=422650&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Mon Jul 17 00:57:37 2006
@@ -54,7 +54,7 @@
      * proxydiscription
      */
     protected TransportOutDescription proxyOutSetting = null;
-	private static final Log log = LogFactory.getLog(CommonsHTTPTransportSender.class);
+    private static final Log log = LogFactory.getLog(CommonsHTTPTransportSender.class);
     protected String httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
 
     private boolean chunked = false;
@@ -268,8 +268,11 @@
                 soapActionString = msgContext.getWSAAction();
             }
 
+
             if (soapActionString == null) {
                 soapActionString = "\"\"";
+            } else if (soapActionString.startsWith("\"")) {  // SOAPAction string must be a quoted string
+                soapActionString = "\"" + soapActionString + "\"";
             }
 
             // select the Message Sender depending on the REST status

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java?rev=422650&r1=422649&r2=422650&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java Mon Jul 17 00:57:37 2006
@@ -298,7 +298,7 @@
     /**
      * Field HEADER_CONNECTION_KEEPALIVE
      */
-    public static final String HEADER_CONNECTION_KEEPALIVE = "Keep-Alive".intern();    
+    public static final String HEADER_CONNECTION_KEEPALIVE = "Keep-Alive".intern();
 
     /**
      * Field HEADER_CONNECTION_CLOSE
@@ -441,6 +441,12 @@
      * context property to true to have the request body gzip compressed.
      */
     public static final String MC_GZIP_REQUEST = "transport.http.gzipRequest";
+
+    /**
+     * This will allow users to set any custom headers to the message context, which will be picked
+     * up by the sender while sending the request
+     */
+    public static final String HTTP_HEADERS = "HTTP_HEADERS";
 
     /**
      * Method getBytes.

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/RESTSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/RESTSender.java?rev=422650&r1=422649&r2=422650&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/RESTSender.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/RESTSender.java Mon Jul 17 00:57:37 2006
@@ -1,19 +1,19 @@
-/*
-* 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.
-*/
-
+/*
+* 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.axiom.om.OMAbstractFactory;
@@ -25,7 +25,6 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.i18n.Messages;
 import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HostConfiguration;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpStatus;
 import org.apache.commons.httpclient.HttpVersion;
@@ -43,7 +42,7 @@
 import java.util.Iterator;
 
 public class RESTSender extends AbstractHTTPSender {
-	private static final Log log = LogFactory.getLog(RESTSender.class);
+    private static final Log log = LogFactory.getLog(RESTSender.class);
 
     /*Obtain two strings;one to go in the url and rest to pass in the body
     **when doing POST in application/x-www-form-urlencoded form.
@@ -129,7 +128,7 @@
                     (String) msgContext.getProperty(Constants.Configuration.HTTP_METHOD);
 
             if ((httpMethod != null)
-                && Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod)) {
+                    && Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod)) {
                 this.sendViaGet(msgContext, url);
 
                 return;
@@ -155,12 +154,12 @@
         // Default encoding scheme
         if (charEncoding == null) {
             getMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
-                                       HTTPConstants.MEDIA_TYPE_X_WWW_FORM + "; charset="
-                                       + MessageContext.DEFAULT_CHAR_SET_ENCODING);
+                    HTTPConstants.MEDIA_TYPE_X_WWW_FORM + "; charset="
+                            + MessageContext.DEFAULT_CHAR_SET_ENCODING);
         } else {
             getMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
-                                       HTTPConstants.MEDIA_TYPE_X_WWW_FORM + "; charset="
-                                       + charEncoding);
+                    HTTPConstants.MEDIA_TYPE_X_WWW_FORM + "; charset="
+                            + charEncoding);
         }
 
         HttpClient httpClient = getHttpClient(msgContext);
@@ -177,14 +176,14 @@
 
             if (value != null) {
                 if ((value.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) >= 0)
-                    || (value.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >= 0)) {
+                        || (value.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >= 0)) {
                     processResponse(getMethod, msgContext);
                 }
             }
         } else {
             throw new AxisFault(Messages.getMessage("transportError",
-                                                    String.valueOf(getMethod.getStatusCode()),
-                                                    getMethod.getResponseBodyAsString()));
+                    String.valueOf(getMethod.getStatusCode()),
+                    getMethod.getResponseBodyAsString()));
         }
     }
 
@@ -218,45 +217,39 @@
         if (httpContentType.equalsIgnoreCase(HTTPConstants.MEDIA_TYPE_X_WWW_FORM)) {
             reqData = createRequest(msgContext, dataout);
             postMethod.setPath(url.getPath() + ((reqData.urlRequest) != null
-                                                ? ("?" + reqData.urlRequest)
-                                                : ""));
+                    ? ("?" + reqData.urlRequest)
+                    : ""));
 
             if (reqData.bodyRequest == null) {
                 reqData.bodyRequest = "0";
             }
             postMethod.setRequestEntity(new AxisRESTRequestEntity(reqData.bodyRequest,
-                                                                  charEncoding, msgContext, httpContentType));
+                    charEncoding, msgContext, httpContentType));
 
         } else {
             postMethod.setPath(url.getPath());
             postMethod.setRequestEntity(new AxisRequestEntity(dataout, chunked, msgContext,
-                                                              charEncoding, soapActionString));
+                    charEncoding, soapActionString));
         }
 
         if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) {
             postMethod.setContentChunked(true);
         }
 
-        postMethod.setRequestHeader(HTTPConstants.HEADER_USER_AGENT, "Axis/2.0");
-
-        if (msgContext.isSOAP11() && !msgContext.isDoingREST()) {
-            postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapActionString);
-        }
-
         postMethod.setRequestHeader(HTTPConstants.HEADER_HOST, url.getHost());
 
         if (httpVersion != null) {
             if (httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)) {
                 httpClient.getParams().setVersion(HttpVersion.HTTP_1_0);
                 postMethod.setRequestHeader(HTTPConstants.HEADER_CONNECTION,
-                                            HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
+                        HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
             } else {
 
                 // allowing keep-alive for 1.1
                 postMethod.setRequestHeader(HTTPConstants.HEADER_CONNECTION,
-                                            HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
+                        HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
                 postMethod.setRequestHeader(HTTPConstants.HEADER_EXPECT,
-                                            HTTPConstants.HEADER_EXPECT_100_Continue);
+                        HTTPConstants.HEADER_EXPECT_100_Continue);
             }
         }
 
@@ -280,7 +273,7 @@
                     String value = contenttypeHheader.getValue();
 
                     if ((value.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) >= 0)
-                        || (value.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >= 0)) {
+                            || (value.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >= 0)) {
                         processResponse(postMethod, msgContext);
 
                         return;
@@ -289,8 +282,8 @@
             }
 
             throw new AxisFault(Messages.getMessage("transportError",
-                                                    String.valueOf(postMethod.getStatusCode()),
-                                                    postMethod.getResponseBodyAsString()));
+                    String.valueOf(postMethod.getStatusCode()),
+                    postMethod.getResponseBodyAsString()));
         } catch (Exception e) {
             log.error("Error in processing POST request", e);
         }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java?rev=422650&r1=422649&r2=422650&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 Mon Jul 17 00:57:37 2006
@@ -18,7 +18,6 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axis2.AxisFault;
@@ -34,7 +33,6 @@
 
 import javax.xml.stream.FactoryConfigurationError;
 import javax.xml.stream.XMLStreamException;
-import javax.xml.namespace.QName;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -68,10 +66,6 @@
             postMethod.setContentChunked(true);
         }
 
-        String userAgentString = getUserAgent(msgContext);
-
-        postMethod.setRequestHeader(HTTPConstants.HEADER_USER_AGENT, userAgentString);
-
         if (msgContext.isSOAP11()) {
             if ("".equals(soapActionString)){
                //if the soap action is empty then we should add two ""
@@ -102,7 +96,7 @@
                         HTTPConstants.HEADER_EXPECT_100_Continue);
             }
         }
-        
+
         // set timeout in client
         long timeout = msgContext.getOptions().getTimeOutInMilliSeconds();
         if (timeout != 0) {
@@ -142,29 +136,6 @@
 
         throw new AxisFault(Messages.getMessage("transportError",
                 String.valueOf(postMethod.getStatusCode()), postMethod.getResponseBodyAsString()));
-    }
-
-    private String getUserAgent(MessageContext messageContext) {
-        String userAgentString = "Axis2";
-        boolean locked = false;
-        if (messageContext.getParameter(HTTPConstants.USER_AGENT) != null){
-            OMElement userAgentElement = messageContext.getParameter(HTTPConstants.USER_AGENT).getParameterElement();
-            userAgentString = userAgentElement.getText().trim();
-            OMAttribute lockedAttribute = userAgentElement.getAttribute(new QName("locked"));
-            if (lockedAttribute != null) {
-                if (lockedAttribute.getAttributeValue().equalsIgnoreCase("true")) {
-                    locked = true;
-                }
-            }
-        }
-        // Runtime overing part
-        if (!locked) {
-            if (messageContext.getProperty(HTTPConstants.USER_AGENT) != null) {
-                userAgentString = (String)messageContext.getProperty(HTTPConstants.USER_AGENT);
-            }
-        }
-
-        return userAgentString;
     }
 
     public class AxisSOAPRequestEntity implements RequestEntity {



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org