Here it is:
      PostMethod post = new PostMethod(m_URL);
      post.setHttp11(false);
      post.setRequestHeader("Content-Length",
Integer.toString(payload.toString().length()));
      post.setRequestHeader("Content-type", "text/xml;charset=utf-8");
      post.setRequestHeader("Content-type", "text/xml;
charset=ISO-8859-1");
      post.setRequestHeader("SOAPAction",
"http://tempuri.org/action/Agent."; + action);
      post.setRequestContentLength(payload.toString().length());
      post.setRequestBody(payload.toString());
 
I tried to also use "keep-alive" connection option (even though I know
it makes little sense for HTTP 1.0), but to no avail.
 
Thanks,
Sofya

        -----Original Message-----
        From: Michael McGrady [mailto:[EMAIL PROTECTED] 
        Sent: Wednesday, May 12, 2004 1:29 PM
        To: Commons HttpClient Project
        Cc: [EMAIL PROTECTED]; Preygel, Sofya
        Subject: Re: 'Socket closed' exception using 
        
        
        How are you setting your headers?  That is sometimes the issue
on socket closings.
        
        At 10:25 AM 5/12/2004, Preygel, Sofya wrote:
        

                Hello,
                
                We are trying to use HTTPClient.execute(PostMethod) for
sending SOAP
                requests to Connotate's Web Mining Server (WMS). The
requests are sent
                every 1 minute, and in most cases everything works fine.
However, every
                so often (sometimes way too often!) we are getting the
'Socket closed'
                exception. The socket timeout was initially set to 10
seconds (10000
                millis), but even after I set it to 120 seconds (120000
millis), we are
                still seeing it happening quite often. I tried to use
both the
                getResponseBodyAsString() and getResponseBodyAsStream()
to retrieve the
                response, but it does not change anything.
                
                The application is running on Windows 2000 (SP4). I
tried both the
                HTTPClient v2.0 (final) and the latest night build (as
of yesterday),
                but the results are the same. We are using HTTP 1.0
                (PostMethod.setHttp11(false)), with the application
running on the same
                computer as the WMS.
                
                I will appreciate any suggestions about what can be done
here.
                
                Thank you,
                Sofya
                
                Stack trace:
                08:54:37 DEBUG [Thread-19] - enter
PostMethod.renerateRequestBody()
                08:54:37 DEBUG [Thread-19] - enter
                EntityEnclosingMethod.renerateRequestBody()
                08:54:37 DEBUG [Thread-19] - enter getContentCharSet(
Header
                contentheader )
                08:54:37 DEBUG [Thread-19] - enter
HeaderElement.parse(String)
                08:54:37 DEBUG [Thread-19] - enter
HeaderElement.parsePair(char[], int,
                int)
                08:54:37 DEBUG [Thread-19] - enter
HeaderElement.parsePair(char[], int,
                int)
                08:54:37 DEBUG [Thread-19] - Using buffered request body
                08:54:37 DEBUG [Thread-19] - enter
                HttpConnection.getRequestOutputStream()
                08:54:37 DEBUG [Thread-19] - Request body sent
                08:54:37 DEBUG [Thread-19] - enter
                HttpConnection.flushRequestOutputStream()
                08:54:37 DEBUG [Thread-19] - enter
HttpConnection.close()
                08:54:37 DEBUG [Thread-19] - enter
                HttpConnection.closeSockedAndStreams()
                08:54:37 DEBUG [Thread-19] - enter
HttpConnection.close()
                08:54:37 DEBUG [Thread-19] - enter
                HttpConnection.closeSockedAndStreams()
                08:54:37 DEBUG [Thread-19] - enter
HttpConnection.close()
                08:54:37 DEBUG [Thread-19] - enter
                HttpConnection.closeSockedAndStreams()
                08:54:37 DEBUG [Thread-19] - enter
HttpConnection.releaseConnection()
                08:54:37 ERROR [Thread-19] - I/O exception executing the
get data
                request 'Execute'. 
                java.net.SocketException: Socket closed
                        at
java.net.SocketOutputStream.socketWrite0(Native Method)
                        at
        
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
                        at
        
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
                        at
        
org.apache.commons.httpclient.HttpConnection$WrappedOutputStream.write(H
                ttpConnection.java:1368)
                        at
        
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:69)
                        at
        
java.io.BufferedOutputStream.flush(BufferedOutputStream.java:127)
                        at
        
org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(Ht
                tpConnection.java:799)
                        at
        
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase
                .java:2324)
                        at
        
org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBa
                se.java:2657)
                        at
        
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java
                :1093)
                        at
        
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:6
                75)
                        at
        
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:5
                29)
                        at
        
pbf.travinfo.dcol.CHPDI.AgentLibrary.getSOAPResponse(AgentLibrary.java:6
                48)
                
        
---------------------------------------------------------------------
                To unsubscribe, e-mail:
[EMAIL PROTECTED]
                For additional commands, e-mail:
[EMAIL PROTECTED]

Reply via email to