Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6630065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:21:00+00:00 2026-05-25T22:21:00+00:00

I am sending a POST request from iPhone to a webservice, which is a

  • 0

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; 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:21:01+00:00Added an answer on May 25, 2026 at 10:21 pm

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application App2 to which I am sending a POST request from
I got some sample code from the net here: http://www.javadb.com/sending-a-post-request-with-parameters-from-a-java-class That works fine. It
i will be sending a POST request to login.php on my server from an
I am sending a POST request using HTTPWebRequest from the client to the Cassini
I'm sending an image file from an iPhone application to a http Post application.
I'm sending an HTTP POST request from my C++ app to a PHP script
I am sending post request from android to the url using httpclient like this
I am sending POST request from client to the application. On the server side
I am an sending a HTTP POST request from a Google Web Toolkit app
I am sending a POST request to a Server from my Android Application. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.