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 3662560
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:25:49+00:00 2026-05-19T01:25:49+00:00

I am new to web services. I need to get information from .NET web

  • 0

I am new to web services. I need to get information from .NET web server. For that I am using the following code:

-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
    [webData setLength: 0];

}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    [webData appendData:data];
    if (data) {
        NSLog(@" bcxbm,xcm,xcmcmx,b data consist %@",data);
    }
    else {
        NSLog(@"not exist");
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" message:@"<Alert message>" delegate:self cancelButtonTitle:@"Retry" otherButtonTitles:@"Cancel", nil];
        [alert show];
        [alert release];
    }

}
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{

    NSLog(@"ERROR with theConenction");
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    NSLog(@"DONE. Received Bytes: %d", [webData length]);

I am able to get information, but I need to validate it. If there is no connect, I need to fire an Alertview. For that I have the code:

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
    {
        [webData appendData:data];
        if (data) {
            NSLog(@" bcxbm,xcm,xcmcmx,b data consist %@",data);
        }
        else {
            NSLog(@"not exist");
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" message:@"<Alert message>" delegate:self cancelButtonTitle:@"Retry" otherButtonTitles:@"Cancel", nil];
            [alert show];
            [alert release];
        }

    }

I check by removing connection. But it does not fire any alerts. After some time, it displays Error in connection in console. But it takes much time. Is there any other possibility than this? How to display alert when there is no connection?

Can anyone please help me?

  • 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-19T01:25:49+00:00Added an answer on May 19, 2026 at 1:25 am

    connection didFailWithError: would be called when connection could not be established. If connection didReceiveData: is being called, it means that you are receiving some kind of data from the web service.

    When you remove the connection, your code tries to connect to the web service and times out after a predefined interval, that is when connection didFailWithError: gets called. It takes time as it tries to connect until the timeout occurs.

    You could check for the internet connectivity before even setting up a connection using Apples’s Reachability example. You can see how to use it from this link

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

Sidebar

Related Questions

I'm working with some web services that have already been created and I need
I'm creating some web services using JAX-WS and the java SE build-in server. Every
I am relatively new to web services and am wondering what the standard best
I'm new to Web Services and XML and was tasked to parse an XML
If I just want to run the new style web services on, say a
I'm new to both Web Services and RMI and I wonder which is the
Happy New Year. I have a bunch of SOAP Web Services. They all have
If you call a web service from Silverlight like this: MyServiceClient serviceClient = new
I am a complete ASP .NET newbie. I've written a set of web services
I'm trying to call an ASP.NET .asmx webservice, from javascript, using other than 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.