I am sending a POST request from iPhone to a webservice, which is a REST layer over SOAP. I am getting Error 408 Request Timeout, testing on both the iPhone device and simulator. When testing with the simulator, I noticed that if I access the webserver from a browser first, then run the simulator, the problem goes away and communication works. Behaviour is very similar to this question HTTP, 408 Request timeout
Here is the code I am using to create the POST request. Has anyone come across this behaviour, and found a solution?
NSString * urlString = [NSString stringWithFormat:@"%@%@", kBaseURL,method];
NSURL * myURL = [NSURL URLWithString:urlString];
NSLog(@"URL %@", myURL);
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:myURL];
[theRequest setHTTPMethod:@"POST"];
[theRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[theRequest setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
[theRequest setTimeoutInterval:60]; // leave at default 60 secs
NSLog(@"Post Body: %@",body);
NSURLConnection *theConnection = [[NSURLConnection alloc]
initWithRequest:theRequest
delegate:self];
if( theConnection ) {
if (webData){
[webData release];
}
webData = [[NSMutableData data] retain];
NSLog(@"connection set up");
}
else {
NSLog(@"theConnection is NULL");
}
self.mainConnection=theConnection;
[theConnection release];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
asked Mar 14, 2011 at 10:06
sorry for my english,
i faced with this stution, too. My application is an exe that calls a webservice. the webservice is coded with apache cxf. Then, i got an error «The remote server returned an unexpected response (408) Request timeout» in client side. but if i access the wsdl from a browser first, my exe runned successfully. i haven’t found any solution. i add the fallowing codes before calls the webservice.
WebClient x = new WebClient();
string source = x.DownloadString("http://......../InfoOperations?wsdl");
if (source != "")
{
// Call your web method here...
}
It does the same thing with browser. this solved the problem. but normally, we don’t need to add this code.
Then, I changed the webservise coding. I used Axis2. but my problem is not solved.
I thought this problem related to firewall.
Connection to webservice times out first time
http://www.mustafakurkcu.com/java/230-cxfclientreturn408.html
answered Oct 1, 2011 at 14:11
I eventually found what was causing this. I tried changing the URL, and found I could access any other website but not the webserver hosting the webservice I needed to communicate with. I tested on 3 different networks plus iPhone on 3G, so it wasn’t a problem on my local network. I also tried using ASIHTTPRequest instead of NSURLConnection, this had no effect. The connection worked if I opened a webbrowser on the same device and pointed it at the remote server before attempting to access the web service.
Turns out the remote server was not handling POST requests correctly, but it was handling GET OK. The browser uses GET, so this is why the browser was able to set up a connection when my web service (using POST) couldn’t. A quick and nasty workaround is to send a GET request and wait until it completes before attempting a POST request.
answered Apr 5, 2011 at 11:09
This error means that the phone did not receive a reply from the server(or there is no connectivity with it) and is common with new installations or when changing the network connectivity, i.e. being it 3G/4G or WiFi network.
Check the routing device/ firewall settings
Common reasons include:
- There is typo (or an extra space) in the host/domain name:
Windows, Mac, Linux and iOS:
Open Zoiper -> Go to Settings -> Accounts -> (your account)
Double check that the setting for «Domain»is correct and does not contain any spaces.
Android:
Open Zoiper -> Go to Settings -> Accounts -> (your account)
Double check that the setting for «Host»is correct and does not contain any spaces.
- There’s an issue with your internet connectivity
Please open your browser and check if you can visit a random website. If not, you have to fix your internet connectivity issue(s) first. If you are not able to do so yourself, we would suggest contacting your ITSP (internet service provider)
- Your network provider is blocking VoIP calls. (this happens mostly in middle eastern countries)
- contact your internet provider and ask if they allow VoIP calls on their network;
- Use TLS encryption for the SIP signalling, especially when combined with a server running SIP on port 443.(this requires server side support for TLS);
- use RTP encryption for media;
- use a third party VPN service;
- Your router is intercepting and changing the packets as they pass through
Be sure to Disable SIP ALG on the router. A list with problematic routers and solutions can be found here http://www.voip-info.org/wiki/view/Routers+SIP+ALG
More detailed instructions:
Zyxel routers:
Netgear routers:
- A firewall on your device is blocking the traffic
Windows:
A list with common firewalls and how to disable them can be found here:
https://help.backblaze.com/hc/en-us/articles/217664708-How-do-I-disable-my-firewall-
Mac:
Please add Zoiper to the list of allowed applications in the macOS firewall.
Instructions can be found here:
Linux:
Please try disabling the Linux firewall.
We do not have complete instructions on how to configure all possible firewalls on the different Linux distributions.
For Ubuntu, please have a look here.
Android:
If you are using Android and have a firewall installed, please Disable it.
iOS:
If you are using a jailbroken iOS iPhone or iPad, please Disable any firewalls you might have installed.
- A NAT router in between the softphone and the server is causing some packets to be dropped
Zoiper has a few settings to trick the server into sending the packets to a different IP address or port.
Please try different settings combinations of STUN (enabled or disabled) or rport for signalling (enabled or disabled).
STUN ON — Rport OFF
STUN ON — Rport ON
STUN OFF — Rport OFF
STUN OFF — Rport ON
Please note that:
A combination that works on one WiFi access point or 3G/4G network might not work on another.
A combination that works one WiFi or cellular network for a specific VoIP server might not work for another one.
If the above fails, please contact your provider or PBX administrator might be able to tweak a server side setting to make things work.
- The PBX or SIP Provider you are trying to connect to is currently down.
Please contact your provider for further assistance;
- Your PBX is on an internal network, but Zoiper is not on the same network and no VPN is running.
Please make sure Zoiper and the PBX or on the same network or setup a VPN between the device running Zoiper and your PBX. Please consult with your system administrator for additional help.
iOS and Android:
- Data usage is blocked for Zoiper on your phone.
Android:
Go to the Android Settings -> Apps -> Zoiper -> Data usage
- Enable background data;
- Enable unrestricted data usage;
iOS:
Go to the iOS settings -> Cellular
Scroll to the section «Use cellular data for» and make sure that data is enabled for Zoiper.
Check also if the needed ports by Zoiper are not blocked in your firewall/ routing device.The default ports used by Zoiper are:
SIP port is random above 32000
IAX port is 4569 UDP
RTP port is 8000 and above UDP
Default STUN vallues:
Server hostname /IP :stun.zoiper.com
Port : 3478 UDP/TCP
Refresh period : 30
- В этой теме 11 ответов, 3 участника, последнее обновление 7 лет, 2 месяца назад сделано
Demon.
Просмотр 12 сообщений — с 1 по 12 (из 12 всего)
-
Автор
Сообщения
-
19.07.2016 в 17:36
#12086
Здравствуйте. Подскажите, какая программа работает на iPhone5? Поставила Zoiper – выдает ошибку 408 Request timeout
Пробовала другие программы – не работают. Добавляла вручную и через QR-code, не помогает. Там есть премиум версия – стоит платить или нет? Очень хотелось бы попробовать звонить на все операторы.
19.07.2016 в 17:40
#12087
Попробуй linphone, сам пользуюсь, устраивает
19.07.2016 в 17:49
#12088
408 Request timeout
Варианты:
– неправильно указан SIP домен
– отключен интернет
– заблокирован SIP протокол.19.07.2016 в 22:30
#12091
Попробуй linphone, сам пользуюсь, устраивает
результат тот же – не удается зарегистрироваться
408 Request timeout
Варианты:
– неправильно указан SIP домен
– отключен интернет
– заблокирован SIP протокол.– указываю домен talk37.ru
– wi-fi работает, 3g тоже (когда недоступен первый, автоматич. подключ. второй)
– где эту настройку можно проверить? проверила в iphon-е – не нашла
20.07.2016 в 00:26
#12092
Домен можно использовать и ruvoip.net
20.07.2016 в 12:21
#12094
Домен можно использовать и ruvoip.net
Пишет ошибку
Сменила в настройках UDP на TCP и теперь отписало, что зарегистрировало
Но пытаясь звонить – сразу сбрасывает и пишет error. Как правильно номер набирать? Или может настройки для дозвона на мобильные неверные и TCP – это что-то другое? В Zoiper также вместо rfc-2833 по умолчанию пришлось указать SIP info (numeric), так как только после этого стал возможен выбор TCP вместо UDP
21.07.2016 в 17:31
#12112
21.07.2016 в 18:22
#12116
Попробовала протокол сменить на TLS тоже регистрирует, но звонить не дает как и раньше. При наборе выдает: sip:номер набираемого телефона@talk37.ru
Настройки все пересмотрела, перепробовала – не помогает21.07.2016 в 18:35
#12118
По служебным номерам звонит благополучно. Подскажите, приложение предусматривает бесплатный дозвон только тем, у кого приложение установлено (по принципу скайпа) или можно звонить и на мобильные. Если можно на мобильные – это бесплатно? В рекламе было – звоните за границу бесплатно – неправильно может поняла?
21.07.2016 в 21:36
#12119
@signale согласно логам сервера Вы звоните всегда исключительно на один и тот же номер… причём чаще всего набирая его неверное (сокращённо).
Все номера нужно набирать в полном формате 380…
Среди доступных в сервисе есть только направления:
Украина.Атлантис-Телеком (+380894)
Украина.Бесплатное 380800
Украина.Интертелеком (+38094)
Украина.КиевНомер, который Вы набираете не попадает ни в одно из этих направлений.
А где эта такая реклама была? Можно ссылочку?
21.07.2016 в 21:41
#12120
Реклама условно говоря. Знакомый мимоходом похвалил, ну и на Android работает, что дало надежду на то, что в целом работает, а только требует настройки. А есть ссылка на список операторов всех, во всех странах?
21.07.2016 в 21:46
#12122
@signale https://talk37.ru/voip/line-status/
доступность направлений не зависит от программного телефона и марки смартфона
-
Автор
Сообщения
Просмотр 12 сообщений — с 1 по 12 (из 12 всего)
- Для ответа в этой теме необходимо авторизоваться.
Перейти к содержанию
Ошибка 408 Request Timeout – это код состояния HTTP, который означает, что запрос, отправленный вами на сервер веб-сайта, например запрос на загрузку веб-страницы, занял больше времени, чем сервер веб-сайта был готов ждать. Другими словами, ваше соединение с сайтом “истекло”.
Сообщения об ошибках 408 Request Timeout часто настраиваются каждым веб-сайтом индивидуально, поэтому эта ошибка может проявляться в разных вариациях ниже, представлен классический вариант:
408: ошибка тайм-аута запроса 408 - тайм-аут запроса
Ошибка 408 Request Timeout отображается в окне интернет-браузера, как и веб-страницы.
Причина 408 ошибок тайм-аута запроса
Самая распространенная причина ошибки 408 Request Timeout – неверный URL. Это также может быть вызвано медленным подключением к интернету или проблемами с подключением.
Как исправить ошибку 408 времени ожидания запроса
Следующие сообщения также являются ошибками на стороне клиента и поэтому в некоторой степени связаны с ошибкой тайм-аут запроса 408: неверный запрос 400, несанкционированный 401, запрещенный 403 и не найденный 404.
-
Повторите попытку загрузки веб-страницы, нажав кнопку обновления и еще раз проверив правильность написания URL в адресной строке. Бывают случаи, когда медленное соединение интернета вызывает задержку, соответственно она и вызывает ошибку 408 Request Timeout. Повторная попытка загрузки страницы часто бывает успешной.
Если во время оформления заказа у интернет-продавца появляется сообщение об ошибке 408 «Запрос тайм-аута», повторные попытки оформления заказа могут привести к созданию нескольких заказов – и повторных платежей! Большинство продавцов защищают от этих ошибок, но некоторые мелкие не могут.
- Ваше интернет-соединение может привести к задержке загрузки страницы. Посетите другой сайт, например Google или YouTube. Если страницы загружаются так же быстро как у вас загружались раньше, проблема с сообщением об ошибке 408 Request Timeout вероятно, связана с веб-сайтом.
-
Однако, если все веб-сайты работают медленно, это может отрицательно сказаться на вашем интернет-соединении. Выполнить тест скорости интернет для ориентира текущей пропускной способности или обратитесь к поставщику услуг Интернета для получения технической поддержки.
-
Вернуться позже. Ошибка 408 Request Timeout является распространенным сообщением об ошибке на очень популярных веб-сайтах, когда огромное увеличение трафика посетителями перегружает серверы. Когда посетители покидают сайт, шансы на успешную загрузку страницы для вас возрастают.
-
Свяжитесь с веб-мастером или другим контактным лицом по поводу сообщения об ошибке 408 Request Timeout.
Просмотров 20.7к.
Обновлено
Я отправляю запрос POST с iPhone на веб-сервис, который представляет собой уровень REST поверх SOAP. Я получаю сообщение об ошибке 408 Request Timeout при тестировании как на устройстве iPhone, так и на симуляторе. При тестировании с помощью симулятора я заметил, что если я сначала захожу на веб-сервер из браузера, а затем запускаю симулятор, проблема исчезает, и связь работает. Поведение очень похоже на этот вопрос HTTP, 408 Request timeout Вот код Я использую для создания запроса POST. Кто-нибудь сталкивался с таким поведением и нашел решение?
NSString * urlString = [NSString stringWithFormat:@"%@%@", kBaseURL,method];
NSURL * myURL = [NSURL URLWithString:urlString];
NSLog(@"URL %@", myURL);
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:myURL];
[theRequest setHTTPMethod:@"POST"];
[theRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[theRequest setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
[theRequest setTimeoutInterval:60]; // leave at default 60 secs
NSLog(@"Post Body: %@",body);
NSURLConnection *theConnection = [[NSURLConnection alloc]
initWithRequest:theRequest
delegate:self];
if( theConnection ) {
if (webData){
[webData release];
}
webData = [[NSMutableData data] retain];
NSLog(@"connection set up");
}
else {
NSLog(@"theConnection is NULL");
}
self.mainConnection=theConnection;
[theConnection release];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;