You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jo...@barclayscapital.com on 2009/02/16 13:43:10 UTC

Client side read timeout

Hi,

I'm making a WS call to a very slow server (HP Service Center) and it's
timing out, so how do I increase the read timeout on the client?

Caused by: java.net.SocketTimeoutException: Read timed out
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.read(SocketInputStream.java:129)
	at
java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
	at
java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
	at
java.io.BufferedInputStream.read(BufferedInputStream.java:317)
	at
sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:652)
	at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec
tion.java:1049)
	at
java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResp
onseInternal(HTTPConduit.java:2001)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResp
onse(HTTPConduit.java:1980)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTP
Conduit.java:1905)
	at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
	at
org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:600)
	at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingI
nterceptor.handleMessage(MessageSenderInterceptor.java:62)
	... 10 more


_______________________________________________

This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Barclays. Any views or opinions presented are solely those of the author and do not necessarily represent those of Barclays. This e-mail is subject to terms available at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the foregoing.  Barclays Capital is the investment banking division of Barclays Bank PLC, a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP.  This email may relate to or be sent from other members of the Barclays Group.
_______________________________________________

RE: Client side read timeout

Posted by Jo...@barclayscapital.com.
Interestingly, this only happens when I use a proxy.  I've looked at a
few other posts and they suggest switching off chunking, but it makes no
difference.  Here's the code:

      ChangeManagement_Service service = new ChangeManagement_Service();

      ChangeManagement port = service.getChangeManagement();
     
      BindingProvider bindingProvider = (BindingProvider) port;
 
bindingProvider.getRequestContext().put(BindingProvider.USERNAME_PROPERT
Y, "jiraws");
 
bindingProvider.getRequestContext().put(BindingProvider.PASSWORD_PROPERT
Y, "test123");

      Client client = ClientProxy.getClient(port);
      HTTPConduit http = (HTTPConduit) client.getConduit();
      HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
      httpClientPolicy.setConnectionTimeout(36000);
      httpClientPolicy.setAllowChunking(false);
      httpClientPolicy.setReceiveTimeout(32000);
      http.setClient(httpClientPolicy);    
      
      port.createChange(createChangeRequest);

And that seems to fix the problem.  

> -----Original Message-----
> From: Baker, John: IT (LDN) 
> Sent: 16 February 2009 14:38
> To: users@cxf.apache.org
> Subject: RE: Client side read timeout
> 
> It would appear CXF is attempting to make a post, setting a 
> content length and not posting any XML.  Hence, the read 
> timeout, because the server is waiting for the post.  I'm 
> watching this through Fiddler (the http proxy).  The standard 
> JDK implementation does post the XML.
> 
> Any ideas?  Headers follow:
> 
> POST /sc61server/ws HTTP/1.1
> Content-Type: text/xml; charset=UTF-8
> Authorization: Basic xxx=
> SOAPAction: "Create"
> Accept: *
> Cache-Control: no-cache
> Pragma: no-cache
> User-Agent: Java/1.6.0_10
> Host: ldnpsr1102:12690
> Connection: keep-alive
> Content-Length: 715
> 
> (and no content posted)
> 
> > -----Original Message-----
> > From: Baker, John: IT (LDN)
> > Sent: 16 February 2009 12:59
> > To: users@cxf.apache.org
> > Subject: RE: Client side read timeout
> > 
> > So here's the answer:
> > 
> > http://cwiki.apache.org/CXF20DOC/client-http-transport.html
> > 
> > 
> > Note, the setReadTimeout method has changed to setReceiveTimeout, I 
> > think?
> > 
> > > -----Original Message-----
> > > From: Baker, John: IT (LDN)
> > > Sent: 16 February 2009 12:43
> > > To: users@cxf.apache.org
> > > Subject: Client side read timeout
> > > 
> > > Hi,
> > > 
> > > I'm making a WS call to a very slow server (HP Service
> > > Center) and it's timing out, so how do I increase the read
> > timeout on
> > > the client?
> > > 
> > > Caused by: java.net.SocketTimeoutException: Read timed out
> > > 	at java.net.SocketInputStream.socketRead0(Native Method)
> > > 	at java.net.SocketInputStream.read(SocketInputStream.java:129)
> > > 	at
> > > java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
> > > 	at
> > > java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
> > > 	at
> > > java.io.BufferedInputStream.read(BufferedInputStream.java:317)
> > > 	at
> > > sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
> > > 	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
> > > 	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:652)
> > > 	at
> > > sun.net.www.protocol.http.HttpURLConnection.getInputStream(Htt
> > > pURLConnec
> > > tion.java:1049)
> > > 	at
> > > 
> > 
> java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
> > > 	at
> > > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.
> > > handleResp
> > > onseInternal(HTTPConduit.java:2001)
> > > 	at
> > > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.
> > > handleResp
> > > onse(HTTPConduit.java:1980)
> > > 	at
> > > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.
> > > close(HTTP
> > > Conduit.java:1905)
> > > 	at
> > > org.apache.cxf.transport.AbstractConduit.close(AbstractConduit
> > > .java:66)
> > > 	at
> > > 
> > 
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:600)
> > > 	at
> > > org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSen
> > > derEndingI
> > > nterceptor.handleMessage(MessageSenderInterceptor.java:62)
> > > 	... 10 more
> > > 
> > > 
> > > _______________________________________________
> > > 
> > > This e-mail may contain information that is confidential,
> > privileged
> > > or otherwise protected from disclosure. If you are not an 
> intended 
> > > recipient of this e-mail, do not duplicate or redistribute
> > it by any
> > > means. Please delete it and any attachments and notify the
> > sender that
> > > you have received it in error. Unless specifically 
> indicated, this 
> > > e-mail is not an offer to buy or sell or a solicitation to
> > buy or sell
> > > any securities, investment products or other financial product or 
> > > service, an official confirmation of any transaction, or an
> > official
> > > statement of Barclays. Any views or opinions presented are solely 
> > > those of the author and do not necessarily represent those of 
> > > Barclays. This e-mail is subject to terms available at the
> > following
> > > link:
> > > www.barcap.com/emaildisclaimer. By messaging with Barclays
> > you consent
> > > to the foregoing.  Barclays Capital is the investment
> > banking division
> > > of Barclays Bank PLC, a company registered in England
> > (number 1026167)
> > > with its registered office at 1 Churchill Place, London, 
> E14 5HP.  
> > > This email may relate to or be sent from other members of
> > the Barclays
> > > Group.
> > > _______________________________________________
> > > 
> > _______________________________________________
> > 
> > This e-mail may contain information that is confidential, 
> privileged 
> > or otherwise protected from disclosure. If you are not an intended 
> > recipient of this e-mail, do not duplicate or redistribute 
> it by any 
> > means. Please delete it and any attachments and notify the 
> sender that 
> > you have received it in error. Unless specifically indicated, this 
> > e-mail is not an offer to buy or sell or a solicitation to 
> buy or sell 
> > any securities, investment products or other financial product or 
> > service, an official confirmation of any transaction, or an 
> official 
> > statement of Barclays. Any views or opinions presented are solely 
> > those of the author and do not necessarily represent those of 
> > Barclays. This e-mail is subject to terms available at the 
> following 
> > link:
> > www.barcap.com/emaildisclaimer. By messaging with Barclays 
> you consent 
> > to the foregoing.  Barclays Capital is the investment 
> banking division 
> > of Barclays Bank PLC, a company registered in England 
> (number 1026167) 
> > with its registered office at 1 Churchill Place, London, E14 5HP.  
> > This email may relate to or be sent from other members of 
> the Barclays 
> > Group.
> > _______________________________________________
> > 
> _______________________________________________
> 
> This e-mail may contain information that is confidential, 
> privileged or otherwise protected from disclosure. If you are 
> not an intended recipient of this e-mail, do not duplicate or 
> redistribute it by any means. Please delete it and any 
> attachments and notify the sender that you have received it 
> in error. Unless specifically indicated, this e-mail is not 
> an offer to buy or sell or a solicitation to buy or sell any 
> securities, investment products or other financial product or 
> service, an official confirmation of any transaction, or an 
> official statement of Barclays. Any views or opinions 
> presented are solely those of the author and do not 
> necessarily represent those of Barclays. This e-mail is 
> subject to terms available at the following link: 
> www.barcap.com/emaildisclaimer. By messaging with Barclays 
> you consent to the foregoing.  Barclays Capital is the 
> investment banking division of Barclays Bank PLC, a company 
> registered in England (number 1026167) with its registered 
> office at 1 Churchill Place, London, E14 5HP.  This email may 
> relate to or be sent from other members of the Barclays Group.
> _______________________________________________
> 
_______________________________________________

This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Barclays. Any views or opinions presented are solely those of the author and do not necessarily represent those of Barclays. This e-mail is subject to terms available at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the foregoing.  Barclays Capital is the investment banking division of Barclays Bank PLC, a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP.  This email may relate to or be sent from other members of the Barclays Group.
_______________________________________________

RE: Client side read timeout

Posted by Jo...@barclayscapital.com.
It would appear CXF is attempting to make a post, setting a content
length and not posting any XML.  Hence, the read timeout, because the
server is waiting for the post.  I'm watching this through Fiddler (the
http proxy).  The standard JDK implementation does post the XML.

Any ideas?  Headers follow:

POST /sc61server/ws HTTP/1.1
Content-Type: text/xml; charset=UTF-8
Authorization: Basic xxx=
SOAPAction: "Create"
Accept: *
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Java/1.6.0_10
Host: ldnpsr1102:12690
Connection: keep-alive
Content-Length: 715

(and no content posted)

> -----Original Message-----
> From: Baker, John: IT (LDN) 
> Sent: 16 February 2009 12:59
> To: users@cxf.apache.org
> Subject: RE: Client side read timeout
> 
> So here's the answer:
> 
> http://cwiki.apache.org/CXF20DOC/client-http-transport.html
> 
> 
> Note, the setReadTimeout method has changed to 
> setReceiveTimeout, I think? 
> 
> > -----Original Message-----
> > From: Baker, John: IT (LDN)
> > Sent: 16 February 2009 12:43
> > To: users@cxf.apache.org
> > Subject: Client side read timeout
> > 
> > Hi,
> > 
> > I'm making a WS call to a very slow server (HP Service
> > Center) and it's timing out, so how do I increase the read 
> timeout on 
> > the client?
> > 
> > Caused by: java.net.SocketTimeoutException: Read timed out
> > 	at java.net.SocketInputStream.socketRead0(Native Method)
> > 	at java.net.SocketInputStream.read(SocketInputStream.java:129)
> > 	at
> > java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
> > 	at
> > java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
> > 	at
> > java.io.BufferedInputStream.read(BufferedInputStream.java:317)
> > 	at
> > sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
> > 	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
> > 	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:652)
> > 	at
> > sun.net.www.protocol.http.HttpURLConnection.getInputStream(Htt
> > pURLConnec
> > tion.java:1049)
> > 	at
> > 
> java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
> > 	at
> > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.
> > handleResp
> > onseInternal(HTTPConduit.java:2001)
> > 	at
> > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.
> > handleResp
> > onse(HTTPConduit.java:1980)
> > 	at
> > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.
> > close(HTTP
> > Conduit.java:1905)
> > 	at
> > org.apache.cxf.transport.AbstractConduit.close(AbstractConduit
> > .java:66)
> > 	at
> > 
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:600)
> > 	at
> > org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSen
> > derEndingI
> > nterceptor.handleMessage(MessageSenderInterceptor.java:62)
> > 	... 10 more
> > 
> > 
> > _______________________________________________
> > 
> > This e-mail may contain information that is confidential, 
> privileged 
> > or otherwise protected from disclosure. If you are not an intended 
> > recipient of this e-mail, do not duplicate or redistribute 
> it by any 
> > means. Please delete it and any attachments and notify the 
> sender that 
> > you have received it in error. Unless specifically indicated, this 
> > e-mail is not an offer to buy or sell or a solicitation to 
> buy or sell 
> > any securities, investment products or other financial product or 
> > service, an official confirmation of any transaction, or an 
> official 
> > statement of Barclays. Any views or opinions presented are solely 
> > those of the author and do not necessarily represent those of 
> > Barclays. This e-mail is subject to terms available at the 
> following 
> > link:
> > www.barcap.com/emaildisclaimer. By messaging with Barclays 
> you consent 
> > to the foregoing.  Barclays Capital is the investment 
> banking division 
> > of Barclays Bank PLC, a company registered in England 
> (number 1026167) 
> > with its registered office at 1 Churchill Place, London, E14 5HP.  
> > This email may relate to or be sent from other members of 
> the Barclays 
> > Group.
> > _______________________________________________
> > 
> _______________________________________________
> 
> This e-mail may contain information that is confidential, 
> privileged or otherwise protected from disclosure. If you are 
> not an intended recipient of this e-mail, do not duplicate or 
> redistribute it by any means. Please delete it and any 
> attachments and notify the sender that you have received it 
> in error. Unless specifically indicated, this e-mail is not 
> an offer to buy or sell or a solicitation to buy or sell any 
> securities, investment products or other financial product or 
> service, an official confirmation of any transaction, or an 
> official statement of Barclays. Any views or opinions 
> presented are solely those of the author and do not 
> necessarily represent those of Barclays. This e-mail is 
> subject to terms available at the following link: 
> www.barcap.com/emaildisclaimer. By messaging with Barclays 
> you consent to the foregoing.  Barclays Capital is the 
> investment banking division of Barclays Bank PLC, a company 
> registered in England (number 1026167) with its registered 
> office at 1 Churchill Place, London, E14 5HP.  This email may 
> relate to or be sent from other members of the Barclays Group.
> _______________________________________________
> 
_______________________________________________

This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Barclays. Any views or opinions presented are solely those of the author and do not necessarily represent those of Barclays. This e-mail is subject to terms available at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the foregoing.  Barclays Capital is the investment banking division of Barclays Bank PLC, a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP.  This email may relate to or be sent from other members of the Barclays Group.
_______________________________________________

RE: Client side read timeout

Posted by Jo...@barclayscapital.com.
So here's the answer:

http://cwiki.apache.org/CXF20DOC/client-http-transport.html


Note, the setReadTimeout method has changed to setReceiveTimeout, I
think? 

> -----Original Message-----
> From: Baker, John: IT (LDN) 
> Sent: 16 February 2009 12:43
> To: users@cxf.apache.org
> Subject: Client side read timeout
> 
> Hi,
> 
> I'm making a WS call to a very slow server (HP Service 
> Center) and it's timing out, so how do I increase the read 
> timeout on the client?
> 
> Caused by: java.net.SocketTimeoutException: Read timed out
> 	at java.net.SocketInputStream.socketRead0(Native Method)
> 	at java.net.SocketInputStream.read(SocketInputStream.java:129)
> 	at
> java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
> 	at
> java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
> 	at
> java.io.BufferedInputStream.read(BufferedInputStream.java:317)
> 	at
> sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
> 	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
> 	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:652)
> 	at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(Htt
> pURLConnec
> tion.java:1049)
> 	at
> java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
> 	at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.
> handleResp
> onseInternal(HTTPConduit.java:2001)
> 	at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.
> handleResp
> onse(HTTPConduit.java:1980)
> 	at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.
> close(HTTP
> Conduit.java:1905)
> 	at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit
> .java:66)
> 	at
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:600)
> 	at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSen
> derEndingI
> nterceptor.handleMessage(MessageSenderInterceptor.java:62)
> 	... 10 more
> 
> 
> _______________________________________________
> 
> This e-mail may contain information that is confidential, 
> privileged or otherwise protected from disclosure. If you are 
> not an intended recipient of this e-mail, do not duplicate or 
> redistribute it by any means. Please delete it and any 
> attachments and notify the sender that you have received it 
> in error. Unless specifically indicated, this e-mail is not 
> an offer to buy or sell or a solicitation to buy or sell any 
> securities, investment products or other financial product or 
> service, an official confirmation of any transaction, or an 
> official statement of Barclays. Any views or opinions 
> presented are solely those of the author and do not 
> necessarily represent those of Barclays. This e-mail is 
> subject to terms available at the following link: 
> www.barcap.com/emaildisclaimer. By messaging with Barclays 
> you consent to the foregoing.  Barclays Capital is the 
> investment banking division of Barclays Bank PLC, a company 
> registered in England (number 1026167) with its registered 
> office at 1 Churchill Place, London, E14 5HP.  This email may 
> relate to or be sent from other members of the Barclays Group.
> _______________________________________________
> 
_______________________________________________

This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Barclays. Any views or opinions presented are solely those of the author and do not necessarily represent those of Barclays. This e-mail is subject to terms available at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the foregoing.  Barclays Capital is the investment banking division of Barclays Bank PLC, a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP.  This email may relate to or be sent from other members of the Barclays Group.
_______________________________________________