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

  • SEARCH
  • Home
  • 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 8616013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:31:10+00:00 2026-06-12T05:31:10+00:00

I have a program that calls a web service post to update information but

  • 0

I have a program that calls a web service post to update information but in the case of a DNS resolution failure, the app just waits for about 30 seconds for the error to come back before it continues normal execution.

NOTE: If the web service post fails, the application can still run fine, so I don’t want to wait for the response. Just post and move on, having the error come back whenever it does.

Below is the send method that comes back with error 410.

// Sends the request via HTTP.
-(void)send {

    // If we don't have a handler, create a default one
if(handler == nil) {
    handler = [[SoapHandler alloc] init];
}

// Make sure the network is available
if([SoapReachability connectedToNetwork] == NO) {
    NSError* error = [NSError errorWithDomain:@"SoapRequest" code:400 userInfo:[NSDictionary dictionaryWithObject:@"The network is not available" forKey:NSLocalizedDescriptionKey]];
    [self handleError: error];
}

// Make sure we can reach the host
if([SoapReachability hostAvailable:url.host] == NO) {
    NSError* error = [NSError errorWithDomain:@"SoapRequest" code:410 userInfo:[NSDictionary dictionaryWithObject:@"The host is not available" forKey:NSLocalizedDescriptionKey]];
    [self handleError: error];
}

// Output the URL if logging is enabled
if(logging) {
    NSLog(@"Loading: %@", url.absoluteString);
}

// Create the request
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL: url];
if(soapAction != nil) {
    [request addValue: soapAction forHTTPHeaderField: @"SOAPAction"];
}
if(postData != nil) {
    [request setHTTPMethod: @"POST"];
    [request addValue: @"text/xml; charset=utf-8" forHTTPHeaderField: @"Content-Type"];
    [request setHTTPBody: [postData dataUsingEncoding: NSUTF8StringEncoding]];
    if(self.logging) {
        NSLog(@"%@", postData);
    }
}

// Create the connection
conn = [[NSURLConnection alloc] initWithRequest: request delegate: self];
if(conn) {
    receivedData = [[NSMutableData data] retain];
} else {
    // We will want to call the onerror method selector here...
    if(self.handler != nil) {
        NSError* error = [NSError errorWithDomain:@"SoapRequest" code:404 userInfo: [NSDictionary dictionaryWithObjectsAndKeys: @"Could not create connection", NSLocalizedDescriptionKey,nil]];
        [self handleError: error];
        }
    }
}

Any suggestions would be greatly appreciated!

Thanks in advance. 🙂

  • 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-06-12T05:31:11+00:00Added an answer on June 12, 2026 at 5:31 am

    You might want to add some returns. I believe that if host is unreachable, you don’t want to proceed with the connection attempt.

    Also, if one of your operations is blocking the thread, you might want to run your whole send method in a background queue.

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

Sidebar

Related Questions

I have a winform app that calls a web service to check for updates.
I am working on a web service program that makes calls back and forth
I have a program that does recursive calls for 2 billion times and the
I have written a c# program that calls a c++ dll that echoes the
I have program that requires Python 3, but I develop Django and it uses
I've created a graphing application that calls a web service. The user can zoom
I have installation solution that have installer project (not web installer but simple installer)
I have a program that does the following: Call webservice (there are many calls
I have a web service that seems to work fine when I am running
I'm trying to create a C# program using a Sharepoint Web Service reference that

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.