Hi again,

OK, I hope that I have got this wrong!

When using HTTPConstants.REUSE_HTTP_CLIENT, it seems that the connection is not released (added to connectionPool.freeConnections) and that means that a new connection is inserted into the connectionPool for each SOAP call. So if you make more calls than hostPool.numConnections (which is apparently 2 by default), then the thread will hang and wait for a connection to be released and that will not happen!

Has anybody got a clue of what I am doing wrong here? Please, help. How can I reuse a http connection?


This is what I am using for the test.
-------------- snip-snip -----------------
package com.emercos.axis.client;

import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.log4j.PropertyConfigurator;

import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import java.io.StringWriter;

/**
* Sample for synchronous single channel blocking service invocation. Message
* Exchage Pattern IN-OUT
*/
public class EchoBlockingClient {
   private static EndpointReference targetEPR = new EndpointReference(
           "http://www.emercos.com:8080/axis2/services/webservices";);

   public static OMElement getEchoOMElement() {
       OMFactory fac = OMAbstractFactory.getOMFactory();
       OMNamespace omNs = fac.createOMNamespace(
               "http://example1.org/example1";, "example1");
       OMElement method = fac.createOMElement("echo", omNs);
       OMElement value = fac.createOMElement("Text", omNs);
       value.addChild(fac.createOMText(value, "Axis2 Echo String "));
       method.addChild(value);

       return method;
   }

   public static void main(String[] args) {
       try {
           PropertyConfigurator.configure("log4j.properties");

           System.setProperty("http.keepAlive", "true");
           OMElement payload = getEchoOMElement();
           Options options = new Options();
           options.setTo(targetEPR);
           options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
           options
.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);

           // Blocking invocation
           ServiceClient sender = new ServiceClient();
           sender.setOptions(options);
           sender.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
                   new Boolean(true));

           OMElement result = null;
           for (int i = 0; i < 10; i++) {
               result = sender.sendReceive(payload);
           }

           StringWriter writer = new StringWriter();
           result.serialize(XMLOutputFactory.newInstance()
                   .createXMLStreamWriter(writer));
           writer.flush();

           System.out.println(writer.toString());

       } catch (AxisFault axisFault) {
           axisFault.printStackTrace();
       } catch (XMLStreamException e) {
           e.printStackTrace();
       }
   }
}



-------------------------------- snip-snip ---------------------------------------
...
27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpClient] DEBUG - Java version: 1.5.0_06 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpClient] DEBUG - Java vendor: Sun Microsystems Inc. 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpClient] DEBUG - Java class path: F:\workspace\sandbox\axis-tes1\build;F:\ToolBox\axis2-1.0\lib\XmlSchema-1.0.2.jar;F:\ToolBox\axis2-1.0\lib\annogen-0.1.0.jar;F:\ToolBox\axis2-1.0\lib\axiom-api-1.0.jar;F:\ToolBox\axis2-1.0\lib\axiom-dom-1.0.jar;F:\ToolBox\axis2-1.0\lib\axiom-impl-1.0.jar;F:\ToolBox\axis2-1.0\lib\backport-util-concurrent-2.1.jar;F:\ToolBox\axis2-1.0\lib\commons-codec-1.3.jar;F:\ToolBox\axis2-1.0\lib\commons-fileupload-1.0.jar;F:\ToolBox\axis2-1.0\lib\commons-logging-1.0.4.jar;F:\ToolBox\axis2-1.0\lib\geronimo-spec-activation-1.0.2-rc4.jar;F:\ToolBox\axis2-1.0\lib\geronimo-spec-javamail-1.3.1-rc5.jar;F:\ToolBox\axis2-1.0\lib\geronimo-spec-jms-1.1-rc4.jar;F:\ToolBox\axis2-1.0\lib\jaxen-1.1-beta-8.jar;F:\ToolBox\axis2-1.0\lib\jaxme2-0.5.1.jar;F:\ToolBox\axis2-1.0\lib\jaxmeapi-0.5.1.jar;F:\ToolBox\axis2-1.0\lib\jaxmejs-0.5.1.jar;F:\ToolBox\axis2-1.0\lib\jaxmexs-0.5.1.jar;F:\ToolBox\axis2-1.0\lib\log4j-1.2.13.jar;F:\ToolBox\axis2-1.0\lib\neethi-1.0.1.jar;F:\ToolBox\axis2-1.0\lib\servletapi-2.3.jar;F:\ToolBox\axis2-1.0\lib\stax-api-1.0.jar;F:\ToolBox\axis2-1.0\lib\stax-utils-20060501.jar;F:\ToolBox\axis2-1.0\lib\wsdl4j-1.5.2.jar;F:\ToolBox\axis2-1.0\lib\wstx-asl-2.9.3.jar;F:\ToolBox\axis2-1.0\lib\xbean-2.1.0.jar;\\Mirakulos\development\projects\axis2-src\classes;\\Mirakulos\development\ToolBox\groovy-1.0-jsr-05\groovy-1.0-jsr-05.jar;\\Mirakulos\development\ToolBox\jibx-1.1\lib\xpp3.jar;\\Mirakulos\development\ToolBox\jibx-1.1\lib\asm-2.1.jar;\\Mirakulos\development\ToolBox\jibx-1.1\lib\asm-commons-2.1.jar;\\Mirakulos\development\ToolBox\jibx-1.1\lib\bcel.jar;\\Mirakulos\development\ToolBox\jibx-1.1\lib\jibx-bind.jar;\\Mirakulos\development\ToolBox\jibx-1.1\lib\jibx-extras.jar;\\Mirakulos\development\ToolBox\jibx-1.1\lib\jibx-run.jar;\\Mirakulos\development\ToolBox\jibx-1.1\lib\stax-api.jar;\\Mirakulos\development\ToolBox\jibx-1.1\lib\wstx-asl.jar;\\Mirakulos\development\ToolBox\jibx-1.1\lib\xmlpull_1_1_4.jar;\\Mirakulos\development\ToolBox\junit4.1\junit-4.1.jar;\\Mirakulos\development\ToolBox\xmlunit\lib\xmlunit1.0.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-xslp.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-antlr.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-apache-bcel.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-apache-bsf.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-apache-log4j.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-apache-oro.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-apache-regexp.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-apache-resolver.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-commons-logging.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-commons-net.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-icontract.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-jai.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-javamail.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-jdepend.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-jmf.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-jsch.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-junit.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-launcher.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-netrexx.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-nodeps.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-starteam.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-stylebook.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-swing.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-trax.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-vaj.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-weblogic.jar;\\Mirakulos\development\ToolBox\apache-ant-1.6.5\lib\ant-xalan1.jar;\\Mirakulos\development\ToolBox\wss4j\wss4j-1.5.0.jar;\\Mirakulos\development\ToolBox\axis2\lib\annogen-0.1.0.jar;\\Mirakulos\development\ToolBox\axis2\lib\axiom-api-1.0.jar;\\Mirakulos\development\ToolBox\axis2\lib\axiom-dom-1.0.jar;\\Mirakulos\development\ToolBox\axis2\lib\axiom-impl-1.0.jar;\\Mirakulos\development\ToolBox\axis2\lib\backport-util-concurrent-2.1.jar;\\Mirakulos\development\ToolBox\axis2\lib\commons-codec-1.3.jar;\\Mirakulos\development\ToolBox\axis2\lib\commons-fileupload-1.0.jar;\\Mirakulos\development\ToolBox\axis2\lib\commons-logging-1.0.4.jar;\\Mirakulos\development\ToolBox\axis2\lib\geronimo-spec-activation-1.0.2-rc4.jar;\\Mirakulos\development\ToolBox\axis2\lib\geronimo-spec-javamail-1.3.1-rc5.jar;\\Mirakulos\development\ToolBox\axis2\lib\geronimo-spec-jms-1.1-rc4.jar;\\Mirakulos\development\ToolBox\axis2\lib\jaxen-1.1-beta-8.jar;\\Mirakulos\development\ToolBox\axis2\lib\jaxme2-0.5.1.jar;\\Mirakulos\development\ToolBox\axis2\lib\jaxmeapi-0.5.1.jar;\\Mirakulos\development\ToolBox\axis2\lib\jaxmejs-0.5.1.jar;\\Mirakulos\development\ToolBox\axis2\lib\jaxmexs-0.5.1.jar;\\Mirakulos\development\ToolBox\axis2\lib\log4j-1.2.13.jar;\\Mirakulos\development\ToolBox\axis2\lib\neethi-1.0.1.jar;\\Mirakulos\development\ToolBox\axis2\lib\servletapi-2.3.jar;\\Mirakulos\development\ToolBox\axis2\lib\stax-api-1.0.jar;\\Mirakulos\development\ToolBox\axis2\lib\stax-utils-20060501.jar;\\Mirakulos\development\ToolBox\axis2\lib\wsdl4j-1.5.2.jar;\\Mirakulos\development\ToolBox\axis2\lib\wstx-asl-2.9.3.jar;\\Mirakulos\development\ToolBox\axis2\lib\xbean-2.1.0.jar;\\Mirakulos\development\ToolBox\axis2\lib\XmlSchema-1.0.2.jar;\\Mirakulos\development\projects\commons-httpclient-3.0.1\src\build 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpClient] DEBUG - Operating system name: Windows XP 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpClient] DEBUG - Operating system architecture: x86 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpClient] DEBUG - Operating system version: 5.1 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpClient] DEBUG - SUN 1.5: SUN (DSA key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS keystore; PKIX CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpClient] DEBUG - SunRsaSign 1.5: Sun RSA signature provider 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpClient] DEBUG - SunJSSE 1.5: Sun JSSE provider(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpClient] DEBUG - SunJCE 1.5: SunJCE Provider (implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, Diffie-Hellman, HMAC) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpClient] DEBUG - SunJGSS 1.0: Sun (Kerberos v5) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpClient] DEBUG - SunSASL 1.5: Sun SASL provider(implements client mechanisms for: DIGEST-MD5, GSSAPI, EXTERNAL, PLAIN, CRAM-MD5; server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5) 27-05-2006 16:34:12 [org.apache.commons.httpclient.params.DefaultHttpParams] DEBUG - Set parameter http.socket.timeout = 60000 27-05-2006 16:34:12 [org.apache.commons.httpclient.params.DefaultHttpParams] DEBUG - Set parameter http.connection.timeout = 60000 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.PostMethod] DEBUG - enter PostMethod.clearRequestBody() 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.EntityEnclosingMethod] DEBUG - enter EntityEnclosingMethod.clearRequestBody() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpClient] DEBUG - enter HttpClient.executeMethod(HostConfiguration,HttpMethod) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpClient] DEBUG - enter HttpClient.executeMethod(HostConfiguration,HttpMethod,HttpState) 27-05-2006 16:34:12 [org.apache.commons.httpclient.MultiThreadedHttpConnectionManager] DEBUG - enter HttpConnectionManager.getConnectionWithTimeout(HostConfiguration, long) 27-05-2006 16:34:12 [org.apache.commons.httpclient.MultiThreadedHttpConnectionManager] DEBUG - HttpConnectionManager.getConnection: config = HostConfiguration[host=http://emercos-mobile:8080], timeout = 0 27-05-2006 16:34:12 [org.apache.commons.httpclient.MultiThreadedHttpConnectionManager] DEBUG - enter HttpConnectionManager.ConnectionPool.getHostPool(HostConfiguration) 27-05-2006 16:34:12 [org.apache.commons.httpclient.MultiThreadedHttpConnectionManager] DEBUG - enter HttpConnectionManager.ConnectionPool.getHostPool(HostConfiguration) 27-05-2006 16:34:12 [org.apache.commons.httpclient.MultiThreadedHttpConnectionManager] DEBUG - Allocating new connection, hostConfig=HostConfiguration[host=http://emercos-mobile:8080] 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodDirector] DEBUG - Attempt number 1 to process request 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.open() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - Open connection to emercos-mobile:8080 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.execute(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.writeRequest(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.writeRequestLine(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.generateRequestLine(HttpConnection, String, String, String, String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.print(String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[]) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[], int, int) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.writeRequestHeaders(HttpState,HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.EntityEnclosingMethod] DEBUG - enter EntityEnclosingMethod.addRequestHeaders(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.ExpectContinueMethod] DEBUG - enter ExpectContinueMethod.addRequestHeaders(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.addRequestHeaders(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.addUserAgentRequestHeaders(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.addHostRequestHeader(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - Adding Host request header 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.addCookieRequestHeader(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpState] DEBUG - enter HttpState.getCookies() 27-05-2006 16:34:12 [org.apache.commons.httpclient.cookie.CookieSpec] DEBUG - enter CookieSpecBase.match(String, int, String, boolean, Cookie[]) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.addProxyConnectionHeader(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.EntityEnclosingMethod] DEBUG - enter EntityEnclosingMethod.addContentLengthRequestHeader(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.EntityEnclosingMethod] DEBUG - enter EntityEnclosingMethod.getRequestContentLength() 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.PostMethod] DEBUG - enter PostMethod.hasRequestContent() 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.EntityEnclosingMethod] DEBUG - enter EntityEnclosingMethod.hasRequestContent() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - HttpMethodBase.addRequestHeader(Header) 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.EntityEnclosingMethod] DEBUG - enter EntityEnclosingMethod.renerateRequestBody() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.print(String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[]) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[], int, int) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.print(String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[]) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[], int, int) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.print(String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[]) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[], int, int) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.print(String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[]) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[], int, int) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.print(String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[]) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[], int, int) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.print(String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[]) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[], int, int) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.writeLine() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[]) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[], int, int) 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.EntityEnclosingMethod] DEBUG - enter EntityEnclosingMethod.writeRequestBody(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.PostMethod] DEBUG - enter PostMethod.hasRequestContent() 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.EntityEnclosingMethod] DEBUG - enter EntityEnclosingMethod.hasRequestContent() 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.EntityEnclosingMethod] DEBUG - enter EntityEnclosingMethod.getRequestContentLength() 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.PostMethod] DEBUG - enter PostMethod.hasRequestContent() 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.EntityEnclosingMethod] DEBUG - enter EntityEnclosingMethod.hasRequestContent() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.getRequestOutputStream() 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.EntityEnclosingMethod] DEBUG - Request body sent 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.flushRequestOutputStream() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.readResponse(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.readStatusLine(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.readLine() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpParser] DEBUG - enter HttpParser.readLine(InputStream, String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpParser] DEBUG - enter HttpParser.readRawLine() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.readResponseHeaders(HttpState,HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.getResponseInputStream() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpParser] DEBUG - enter HeaderParser.parseHeaders(InputStream, String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpParser] DEBUG - enter HttpParser.readLine(InputStream, String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpParser] DEBUG - enter HttpParser.readRawLine() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpParser] DEBUG - enter HttpParser.readLine(InputStream, String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpParser] DEBUG - enter HttpParser.readRawLine() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpParser] DEBUG - enter HttpParser.readLine(InputStream, String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpParser] DEBUG - enter HttpParser.readRawLine() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpParser] DEBUG - enter HttpParser.readLine(InputStream, String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpParser] DEBUG - enter HttpParser.readRawLine() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpParser] DEBUG - enter HttpParser.readLine(InputStream, String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpParser] DEBUG - enter HttpParser.readRawLine() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpParser] DEBUG - enter HttpParser.readLine(InputStream, String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpParser] DEBUG - enter HttpParser.readRawLine() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.processResponseHeaders(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.cookie.CookieSpec] DEBUG - enter CookieSpecBase.parse(String, port, path, boolean, String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.cookie.CookieSpec] DEBUG - enter CookieSpecBase.parse(String, port, path, boolean, Header) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HeaderElement] DEBUG - enter HeaderElement.parseElements(char[]) 27-05-2006 16:34:12 [org.apache.commons.httpclient.Cookie] DEBUG - enter Cookie(String, String, String, String, Date, boolean) 27-05-2006 16:34:12 [org.apache.commons.httpclient.cookie.CookieSpec] DEBUG - enter RFC2109Spec.validate(String, int, String, boolean, Cookie) 27-05-2006 16:34:12 [org.apache.commons.httpclient.cookie.CookieSpec] DEBUG - enter CookieSpecBase.validate(String, port, path, boolean, Cookie) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpState] DEBUG - enter HttpState.addCookie(Cookie) 27-05-2006 16:34:12 [org.apache.commons.httpclient.cookie.CookieSpec] DEBUG - enter RFC2109Spec.formatCookie(Cookie) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - Cookie accepted: "$Version=0; JSESSIONID=CC37ADC41E5883910FA6DC3A34C8051F; $Path=/axis2" 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.readResponseBody(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.readResponseBody(HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.getResponseInputStream() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.canResponseHaveBody(int) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HeaderElement] DEBUG - enter HeaderElement.parseElements(String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HeaderElement] DEBUG - enter HeaderElement.parseElements(char[]) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.isResponseAvailable(int) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HeaderElement] DEBUG - enter HeaderElement.parseElements(String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HeaderElement] DEBUG - enter HeaderElement.parseElements(char[]) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HeaderElement] DEBUG - enter HeaderElement.getParameterByName(String) 27-05-2006 16:34:12 [org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder] DEBUG - START_ELEMENT: {http://schemas.xmlsoap.org/soap/envelope/}Envelope:Envelope 27-05-2006 16:34:12 [org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder] DEBUG - Starting to process SOAP 1.1 message 27-05-2006 16:34:12 [org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder] DEBUG - Build the OMElelment EnvelopeBy the StaxSOAPModelBuilder 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Checking pre-condition for Phase "Transport" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Invoking phase "Transport" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Invoking Handler 'RequestURIBasedDispatcher' in Phase 'Transport' 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Invoking Handler 'SOAPActionBasedDispatcher' in Phase 'Transport' 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Checking post-conditions for phase "Transport" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Checking pre-condition for Phase "Security" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Invoking phase "Security" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Checking post-conditions for phase "Security" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Checking pre-condition for Phase "PreDispatch" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Invoking phase "PreDispatch" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Checking post-conditions for phase "PreDispatch" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Checking pre-condition for Phase "Dispatch" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Invoking phase "Dispatch" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Invoking Handler 'AddressingBasedDispatcher' in Phase 'Dispatch' 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Invoking Handler 'SOAPMessageBodyBasedDispatcher' in Phase 'Dispatch' 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Invoking Handler 'InstanceDispatcher' in Phase 'Dispatch' 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Checking post-conditions for phase "Dispatch" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Checking pre-condition for Phase "OperationInPhase" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Invoking phase "OperationInPhase" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Checking post-conditions for phase "OperationInPhase" 27-05-2006 16:34:12 [org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder] DEBUG - START_ELEMENT: {http://schemas.xmlsoap.org/soap/envelope/}Header:Header 27-05-2006 16:34:12 [org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder] DEBUG - Build the OMElelment HeaderBy the StaxSOAPModelBuilder 27-05-2006 16:34:12 [org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder] DEBUG - END_ELEMENT: {http://schemas.xmlsoap.org/soap/envelope/}Header:Header 27-05-2006 16:34:12 [org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder] DEBUG - START_ELEMENT: {http://schemas.xmlsoap.org/soap/envelope/}Body:Body 27-05-2006 16:34:12 [org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder] DEBUG - Build the OMElelment BodyBy the StaxSOAPModelBuilder 27-05-2006 16:34:12 [org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder] DEBUG - START_ELEMENT: {http://example1.org/example1}echo:echo 27-05-2006 16:34:12 [org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder] DEBUG - Build the OMElelment echoBy the StaxSOAPModelBuilder 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Checking pre-condition for Phase "OperationOutPhase" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Invoking phase "OperationOutPhase" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Checking post-conditions for phase "OperationOutPhase" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Checking pre-condition for Phase "PolicyDetermination" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Invoking phase "PolicyDetermination" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Checking post-conditions for phase "PolicyDetermination" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Checking pre-condition for Phase "MessageOut" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Invoking phase "MessageOut" 27-05-2006 16:34:12 [org.apache.axis2.engine.Phase] DEBUG - Checking post-conditions for phase "MessageOut" 27-05-2006 16:34:12 [org.apache.commons.httpclient.params.DefaultHttpParams] DEBUG - Set parameter http.socket.timeout = 60000 27-05-2006 16:34:12 [org.apache.commons.httpclient.params.DefaultHttpParams] DEBUG - Set parameter http.connection.timeout = 60000 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.PostMethod] DEBUG - enter PostMethod.clearRequestBody() 27-05-2006 16:34:12 [org.apache.commons.httpclient.methods.EntityEnclosingMethod] DEBUG - enter EntityEnclosingMethod.clearRequestBody() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpClient] DEBUG - enter HttpClient.executeMethod(HostConfiguration,HttpMethod) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpClient] DEBUG - enter HttpClient.executeMethod(HostConfiguration,HttpMethod,HttpState) 27-05-2006 16:34:12 [org.apache.commons.httpclient.MultiThreadedHttpConnectionManager] DEBUG - enter HttpConnectionManager.getConnectionWithTimeout(HostConfiguration, long) 27-05-2006 16:34:12 [org.apache.commons.httpclient.MultiThreadedHttpConnectionManager] DEBUG - HttpConnectionManager.getConnection: config = HostConfiguration[host=http://emercos-mobile:8080], timeout = 0 27-05-2006 16:34:12 [org.apache.commons.httpclient.MultiThreadedHttpConnectionManager] DEBUG - enter HttpConnectionManager.ConnectionPool.getHostPool(HostConfiguration) 27-05-2006 16:34:12 [org.apache.commons.httpclient.MultiThreadedHttpConnectionManager] DEBUG - enter HttpConnectionManager.ConnectionPool.getHostPool(HostConfiguration) 27-05-2006 16:34:12 [org.apache.commons.httpclient.MultiThreadedHttpConnectionManager] DEBUG - Allocating new connection, hostConfig=HostConfiguration[host=http://emercos-mobile:8080] 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodDirector] DEBUG - Attempt number 1 to process request 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.open() 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - Open connection to emercos-mobile:8080 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.execute(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.writeRequest(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.writeRequestLine(HttpState, HttpConnection) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.generateRequestLine(HttpConnection, String, String, String, String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.print(String) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[]) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpConnection] DEBUG - enter HttpConnection.write(byte[], int, int) 27-05-2006 16:34:12 [org.apache.commons.httpclient.HttpMethodBase] DEBUG - enter HttpMethodBase.writeRequestHeaders(HttpState,HttpConnection)
....

Med venlig hilsen / Kind regards,
Morten Steffensen

Emercos ApS
http://www.emercos.com



Morten Steffensen skrev:
Hi Davanum Srinivas,

Thank you for the answer. In fact I did already dig that information out from the source code, and have tried it, but reusing the HttpClient does not mean that the *connection* is reused. Try to use ethereal and see. The port number changes for every call. I understood that the http property "Keep-alive" means that the actual socket connection is reused for every http request/response between the same client/server pair.

Med venlig hilsen / Kind regards,
Morten Steffensen

Emercos ApS
http://www.emercos.com



Davanum Srinivas skrev:
http://www.wso2.net/2006/05/reuse_share_http_connections

On 5/26/06, Morten Steffensen <[EMAIL PROTECTED]> wrote:
Hello happy axis users,

How do I prevent axis2 client from making a new connection for every call?

I have built a client app based on the axis2 v1.0. The client is built
like the EchoBlockingClient userguide sample. It seems that every call
is done by a opening a new connection to the server. There doesn't seem
to be any Keep-alive property in the http header. I have searched in the documentation and in the source code for a hook to switch Keep-alive on,
but did not succeed. So I just added a setRequestHeader into the
SOAPOverHttpSender.java. Now I get the Keep-alive in the http header,
but it still seems that a new connection is opened for each call.

Please, help me with a hint on how to reuse connections.

--
Med venlig hilsen / Kind regards,
Morten Steffensen

Emercos ApS
http://www.emercos.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






--
Med venlig hilsen / Kind regards,
Morten Steffensen

Emercos ApS
http://www.emercos.com



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to