title: ASIHTTPRequestErrorDomain Code=1
body: <p>I am new to iPhone development. My app will call a web service running in apache tomcat. 
  <a href="http://localhost:8080/myApp/WebservicePathName" rel="nofollow">http://localhost:8080/myApp/WebservicePathName</a></p>
  
  <p>Following are the code which calls my REST web-service:</p>
  
  <pre><code>ASIHTTPRequest *req;
  NSURL *url = [NSURL URLWithString:@"http://localhost:8080/myApp/WebservicePathName"];
          req = [ASIHTTPRequest requestWithURL:url];
          [req setRequestMethod:@"POST"];
          [req setDelegate:self];
          [req setTimeOutSeconds:10000];
          [req setDidFailSelector:@selector(eventUploadFailed:)];
          [req setDidFinishSelector:@selector(eventUploadFinished:)];
          [req appendPostData:[myString  dataUsingEncoding:NSUTF8StringEncoding]]; 
          [req startSynchronous];
  
  My web service code will be as:
  @Path("/WebservicePathName")
  @POST
  public String post(String theString)
      {
          return theString;
      }
  </code></pre>
  
  <p>When I run the code in iPhone, in  <code>[req startSynchronous]</code>, I get an error in console like:</p>
  
  <blockquote>
    <p>ASIHTTPRequestErrorDomain Code=1 "A connection failure occurred"
    UserInfo=0x1664a0 {NSUnderlyingError=0x1b2130 "The operation couldn’t
    be completed. Operation timed out", NSLocalizedDescription=A
    connection failure occurred}</p>
  </blockquote>
  
  <p>Can anyone say whats wrong in it. whether the problem is with webservice call or response.
  Thanks in advance.</p>