So I am using iOS 5.0.1 with iPhone 4s (tested with 4 too) and using Sudz-c generated code to connect our web service. The service works great over wifi but if I try over 3g or EDGE connection it doesn’t work. I got following error:
It loads the url from the Safari, even over 3g/edge.
2012-01-15 18:32:13.987 SudzCExamples[487:707] Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x18af60 {NSErrorFailingURLStringKey=http://sensored/app/soap/sensored/, NSErrorFailingURLKey=http://sensored/app/soap/sensored/, NSLocalizedDescription=The request timed out., NSUnderlyingError=0x18afa0 "The request timed out."}
2012-01-15 18:32:13.988 SudzCExamples[487:707] Error: The request timed out.
The url request in SoapRequest ever gets respone
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
Any advices?
UPDATE: If I use other server using the same code, it works great over 3g too. It seems that the problem is in our server side code. Any ideas what could cause this?
UPDATE 2:
Phone 1: The app works only over wifi.(Carrier: Sonera)
Phone 2: The app works only over wifi.(Carrier: Sonera)
Phone 3: The app works only over wifi.(Carrier: Sonera)
Phone 4: The app works great over 3g and wifi. (Carrier: Elisa)
iPad: The app works great over 3g and wifi. (Carrier: Elisa)
If I use our service with phone 4, it works great over 3g too. If I tether internet connection from phone 4 to iPhone1 (or 2 or 3), it will work over that tethered wifi, but not over its own 3g. If I tether phone 1 (or 2 or 3) connection to the phone 4, it doesn’t work over that tethered wifi on phone 4.
Only difference which I can notice between those phones are that Phone 1 and 2 and 3 uses Finnish internet connection provider called TeliaSonera and the phone 4 uses Elisa.
UPDATE 3: I run the app in iphone simulator and it works great. After I start Charles Proxy it doesn’t work anymore. The request goes successfully to the server and actually it gives the response too, even the app fails.
There is the request and the response which the Charles Proxy software shows:
Request
POST /app/soap/sensored/ HTTP/1.1
Host: sensored
User-Agent: Sensored/1.0 CFNetwork/548.0.3 Darwin/11.2.0
Content-Length: 396
Accept: */*
SOAPAction: urn:sensoredSoapModelAction
Content-Type: text/xml; charset=utf-8
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Cookie: PHPSESSID=a60ef32d72121d625a95b75b90d48a22
Connection: keep-alive
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:sensored"><soap:Body><checkUpdates><authHash>daswwe12e2e2wweqwessd</authHash><lastCheckDate>2012-01-19 05:45</lastCheckDate></checkUpdates></soap:Body></soap:Envelope>
Response
HTTP/1.1 200 OK
Date: Thu, 19 Jan 2012 05:45:34 GMT
Server: Apache
X-Powered-By: PHP/5.3.2-1ubuntu4.11
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 537
Keep-Alive: timeout=5
Connection: Keep-Alive
Content-Type: text/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:sensored" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:checkUpdatesResponse><checkUpdatesReturn xsi:type="xsd:string">[dds2d,asddd2,a0333f,20dks]</checkUpdatesReturn></ns1:checkUpdatesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
Overview
URL http://sensored/app/soap/sensored/
Status Complete
Response code 200 OK
Protocol HTTP/1.1
Method POST
Content-type text/xml; charset=utf-8
Client address /127.0.0.1
Remote Address sensored/177.33.83.129
Request Start time 19.1.2012 7:45:27
Request End time 19.1.2012 7:45:27
Response Start time 19.1.2012 7:45:28
Response End time 19.1.2012 7:45:33
Duration 5.77 sec
Request Duration 532 ms
Response Duration 4.99 sec
Latency 250 ms
Speed 0,24 KB/s
Response speed 0,13 KB/s
Request Header Size 366 bytes
Response Header Size 400 bytes
Request Size 396 bytes
Response Size 272 bytes
Total size 1,40 KB (1434 bytes)
Request Compression -
Response Compression 49,3% (gzip)
Is the server host you are trying to reach an address that is reachable over the 3G network? When you are on a WiFi network, you likely have the ability to reach any number of domains via that network. Not all of those networks are necessarily visible when you connect via a 3G network.
If that server is available over the 3G network, another possibility is that the service you are hitting could have restrictions, either intentional or accidental, that are being tripped when you come into the service in a different way. An example of an intentional restriction could be a service that looks at the IP address of the requester and only responds if the request is coming from an in-network client. An example of an accidental restriction could be a service that expects a certain header that is automatically inserted by a local network proxy but that never gets inserted when circumventing that proxy by going through 3G.
Do you have any access to servers-side logs that might provide you more guidance? Any control of how the service is configured? It sounds like the 3G service from TeliaSonera is doing something different in its connection that is making a difference in how the message is received (or if it is received at all) by your service.