Using Commons HTTP client with Axis By default Apache Axis 1.4 uses 'org.apache.axis.transport.http.HTTPSender' for http sending.
It is possible to change this to use 'org.apache.commons.httpclient'. Change the transport pivot attribute in the configuration to point to the CommonsHTTPSender class. <transport name="http" pivot="java:org.apache.axis.transport.http.CommonsHTTPSender"/> The following is an example of an axis client configuration file. <?xml version="1.0" encoding="UTF-8"?> <deployment name="defaultClientConfig" xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <globalConfiguration> <parameter name="disablePrettyXML" value="true"/> <parameter name="enableNamespacePrefixOptimization" value="false"/> </globalConfiguration> <transport name="http" pivot="java:org.apache.axis.transport.http.CommonsHTTPSender"/> <transport name="local" pivot="java:org.apache.axis.transport.local.LocalSender"/> <transport name="java" pivot="java:org.apache.axis.transport.java.JavaSender"/> </deployment> You also need to add the common.codec.1.3.jar and common-httpclient-3.0-rc4.jar to the jar directory. http://jakarta.apache.org/commons/ http://jakarta.apache.org/commons/httpclient/ http://jakarta.apache.org/commons/httpclient/features.html http://jakarta.apache.org/site/downloads/downloads_commons.html http://jakarta.apache.org/commons/httpclient/logging.html By default commons http client uses HTTP protocol 1.1 and by default it uses chunked transfer encoding. When a HTTP client program sends Transfer-Encoding chunked, it cannot send Content-Length. You can also programmatically switch back to HTTP/1.0 by using the following code. stub._setProperty ( org.apache.axis.MessageContext.HTTP_TRANSPORT_VERSION , org.apache.axis.transport.http.HTTPConstants.HEADER_PROTOCOL_V10); ============================================================================ ======================= -----Original Message----- From: Walker, Jeff [mailto:[EMAIL PROTECTED] Sent: Thursday, 4 October 2007 2:35 AM To: axis-user@ws.apache.org Subject: RE: Axis 1.4 configuration to use HTTP/1.1 Hi, So, I tried playing around with the http version. Theoretically, you should be able to set a property on the binding (or at least, the Call object) to switch between http 1.0 and http 1.1 This did not work. I could only manage to change to http 1.1 by editing the method writeToSocket() in HTTPSender where it says: String httpver = msgContext.getStrProp(MessageContext.HTTP_TRANSPORT_VERSION); if (null == httpver) { httpver = HTTPConstants.HEADER_PROTOCOL_V10; } To String httpver = msgContext.getStrProp(MessageContext.HTTP_TRANSPORT_VERSION); if (null == httpver) { httpver = HTTPConstants.HEADER_PROTOCOL_V11; } Note how all I did was change the httpver variable. The issue is, you then need to recompile Axis to pick up the change in HTTPSender. To get around the fact we are supposed to use the binary distribution and can't recompile Axis, I wrote my own class that extends HTTPSender and then over rode the writeToSocket() method. I simply cut and pasted that method in its entirety to the equivalent method in my class and edited the line I mentioned above. The next step is to make sure you pick up your sender and not the default HTTPSender. You can do this by edting the client-config.wsdd file to pick up your class like this: Client-config.wsdd: <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <transport name="http" pivot="java:com.company.www.project.FMRHttpSender"/> </deployment> Where my class is obviously called FMRHTTPSender. After all that, it worked. ----------------------------------------- As a much easier alternative, CommonsHTTPSender by default uses http 1.1. So, simply create a client-config.wsdd file and pick up the Commons sender. Something like this should work: <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <transport name="http" pivot="java:org.apache.axis.transport.http.CommonsHTTPSender"/> </deployment> The above commons sender also worked for me. Cheers, -jeff -----Original Message----- From: Shadab [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 03, 2007 3:37 AM To: axis-user@ws.apache.org Subject: Axis 1.4 configuration to use HTTP/1.1 Hi All, Please let me know if there is any way to configure Axis1.4 such that it uses HTTP/1.1 instead of HTTP/1.0 The request from the soapclient (implemented using service stub) lands with Axis/1.4 which in turn by default presumably uses HTTP/1.0. Can't this be changed somehow using CommonsHTTPSender as pointed by mail thread of Mario/Jeff "Axis 1.4 CommonsHTTPSender question" Date Sep:20:2007 ? Mario/Jeff, Please let me know if you people have reached some solution and will that solution be helpful in the scenario I have told above... Thanks, Shadab -- View this message in context: http://www.nabble.com/Axis-1.4-configuration-to-use-HTTP-1.1-tf4560281.h tml#a13014221 Sent from the Axis - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]