Blackberry Httpconnection Request Timeout issue - web-services

I am facing issue related to Httpconnection request timeout (not response timeout).
When i am trying to connect with the server via application i am getting response code 408 or 502 but the same url is working on the blackberry default browser (plz not that this happen only in the 3G network).
And this issue not reprodusing each and every time but it occurs 70 % times.

From Wikipedia http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
408 Request Timeout
The server timed out waiting for the request.[2] According to W3 HTTP specifications: "The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time."
502 Bad Gateway
The server was acting as a gateway or proxy and received an invalid response from the upstream server.
So I am guessing some sort of proxy/gateway needs to be set in your application (as may be set in your default BB browser).
Cheers!

Related

How to force HTTP2 client to reconnect to server?

It is needed to make a HTTP2-response, which will force a client to reconnect to the same server to the same address.
In case of HTTP/1.1 it could be done sending 307 Temporary Redirect response with Connection: close header.
In HTTP/2 Connection: close header is ignored and redirect is performed without reconnection, which brings to redirect loop error.
Also, I've tried to send 421 Misdirected Request response to client with the same url, but Chrome browser is do nothing after receiving this response.
What is the most proper way to force a HTTP/2 client to reconnect? Which server response can be send? Maybe some kind of GOAWAY frame?
Following the graceful shutdown procedure that RFC 7540 recommends should result in a reconnection:
A server that is attempting to gracefully shut down a connection
SHOULD send an initial GOAWAY frame with the last stream identifier
set to 2^31-1 and a NO_ERROR code. This signals to the client that
a shutdown is imminent and that initiating further requests is
prohibited. After allowing time for any in-flight stream creation
(at least one round-trip time), the server can send another GOAWAY
frame with an updated last stream identifier. This ensures that a
connection can be cleanly shut down without losing requests.
Regarding 421 handling in Chrome, this bug https://bugs.chromium.org/p/chromium/issues/detail?id=546991 was opened to have Chrome re-open a new connection to the server, it's seen some activity recently.
Yes, the way on HTTP/2 to ask a client to reconnect for further requests is to send a GOAWAY frame to it. How this works depends on your server side implementation or framework for HTTP/2 support. E.g. a framework could intercept your Connection: close header and treat it as a request to close the connection after the request. But I guess most HTTP/2 implementations wouldn't like to do that, since they guess the header targets only the current request scope and not the whole connection. Alternatively the framework could provide a way in the request handler to not only access the request and response data but also to get a reference to the HTTP/2 connection, which can be used to send the GOAWAY.
This may help you Google HTTP2

HTTP Status Code 504 happens only when requests are sent from one specific server

I have a program that I install on my clients' server which sends a couple of HTTP requests to a web service. This has always worked fine, but for one client the requests always get a 504 - Gateway Timeout Error. When I send the same requests from my own computer, I always get a quick 200 OK response.
My initial thought was that it must be some kind of firewall issue, however requests do occasionally get a 200 OK response.
Any ideas on what may cause this and what I can do about it?

Is it possible to alter the HTTP client timeout period (cpp-netlib)?

I'm using cpp-netlib (v0.11.0) to send HTTP requests.
I'd like to know if it's possible to alter the timeout period when sending an HTTP POST request.
I'm running some unit tests, one of which sends an HTTP request to an address where there is no server running. An attempt to pull information from the response times-out after about 90s with the error "Operation timed out".
When the constructor for the client class is invoked, you can pass an options class that you can set the timeout in. See the docs for the client class constructors (and then scroll down a bit) for more specific information.

SAP webservice client timeout

I have a C# client that is consuming a SAP web service. This client is hosted on IIS and the client works by adding a web reference to the WSDL.
While sending a request, the connection times out and this happens at 63 seconds. I get a html dump in my logs saying
System.InvalidOperationException: Client found response content type of 'text/html', but expected 'text/xml'.
The request failed with the error message:
Application Server Error
500 Connection timed out
Wed May 07 18:53:53 2014
I have no where hardcoded this timeout and can't understand why is this happening. Has anybody see such a thing before, can I get any help resolving this.
Solved the problem,
The main problem we were having was there was no live connection to SAP and we could only test production code on site and hence couldn't debug live.
On the same system as our client we ran SOAPUI and tested the connection to SAP. The same error of connection time out was thrown at about 63 to 64 seconds. Increasing the time out on SOAPUI had no effect and that proved that there was nothing wrong with our client code.
It was finally narrowed down to an Web dispatcher/load balancer that funnels all communication to SAP server and that had a time out of 60 seconds. So any response from SAP that took more than 60 seconds would be killed and the client would get a timeout error.
Increasing this timeout got rid of the problem and we could download SAP data fine.
Hope this helps somebody in the future.
Thank you

What specific error am I getting when I make a request to a server that is completely offline?

I looked online but I could not get a clear answer.
Would I get a 503 Service Unavailable, because the DNS is still running but the web server is down? Or something else.
Receiving a 408 error, or any HTTP error for that matter, would require a valid connection to the server. Since in your example the server is offline, the request would time out and a socket would never be created.