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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:23:54+00:00 2026-06-01T20:23:54+00:00

I am really new to Xcode and I need to connect to a web

  • 0

I am really new to Xcode and I need to connect to a web service API (SOAP + DES), which means I have to send a Username, Password, Key and IV to the server before I can get the XML file and parse it.

Is there any tutorial about connecting to a Web Service API (SOAP + DES) from an iPhone?

    -(IBAction)buttonClick:(id)sender
{
    recordResults = NO;

    NSString *soapMessage = [NSString stringWithFormat:
     @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
     "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance" "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema" "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
     "<soap:Header>"
     "<CredentialSoapHeader xmlns=\"http://tempuri.org/\">"
     "<userID>xxxxx</userID>"
     "<Password>xxxx</Password>"
     "</CredentialSoapHeader>"
     "</soap:Header>"
     "<soap:Body>"
     "<GetNearUserByArticleLatLon xmlns=\"http://tempuri.org/\">"
     "<strXML>"
                             "<XMLDATA>\n"
                             "<KeyWord></KeyWord>\n"
                             "<Lat>0</Lat>\n"
                             "<Lon>0</Lon>\n"
                             "<IP>219.71.65.55</IP>\n"
                             "<CurrentPage>1</CurrentPage>\n"
                             "<PageSize>10</PageSize>\n"
                             "</XMLDATA>\n"
                             "</strXML>"
     "</GetNearUserByArticleLatLon>"
     "</soap:Body>"
     "</soap:Envelope>"];


    NSLog(@"%@", soapMessage);

    //http://www.xignite.com/services/GetRealQuote
    NSURL *url = [NSURL URLWithString:@"http://api3.mmnears.com/API/api.asmx?op=GetNearUserByArticleLatLon"];
    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
    NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]];

    [theRequest addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
    [theRequest addValue:@"http://tempuri.org/GetNearUserByArticleLatLon" forHTTPHeaderField:@"SOAPAction"];
    [theRequest addValue:msgLength forHTTPHeaderField:@"Content-Length"];
    [theRequest setHTTPMethod:@"POST"];
    [theRequest setHTTPBody:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];


    NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
    NSLog(@"theConnection = %@",theConnection);

    if(theConnection)
    {
        webData = [[NSMutableData data] retain];
        NSLog(@"WebData = %@",webData);

    }
    else 
    {
        NSLog(@"theConnection is null");
    }

}


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

    httpResponse = (NSHTTPURLResponse *) response;

    NSLog(@"HTTP error %zd", (ssize_t) httpResponse.statusCode);

}

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData*)data
{
    [webData appendData:data];
    NSLog(@"webdata: %@", data);

}

-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError*)error
{
    NSLog(@"error with the connection");
    [connection release];
    [webData release];
}

-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    NSLog(@"DONE. Received bytes %d", [webData length]);
    NSString *theXML = [[NSString alloc] initWithBytes:[webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding];
    NSLog(@"xml %@",theXML);
    [theXML release];
  • 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-01T20:23:56+00:00Added an answer on June 1, 2026 at 8:23 pm

    If you want a quick reference of it all here you have a couple of tutorials that helped me out:

    1) http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service-for-an-ios-app

    2) http://www.raywenderlich.com/2965/how-to-write-an-ios-app-that-uses-a-web-service

    Good luck!

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

Sidebar

Related Questions

Hey there, I'm a designer thats really new to programming with xcode or Objective-C
I'm new to iPhone development and Xcode, so this might be really obvious. I
im really new to flash, how do i go about creating a variable which
I am really new to Python and I have been looking for an example
I have made a basic tabbar view app in xcode but I need it
Hey all. I'm really new at this obj-c/xcode stuff. I'm trying to load the
I just started doing some reading (new to xcode/iphone development) into web services and
I'm really struggling to get this to work in xcode 4. I have one
New to Xcode so I'm not really sure about this. Is Xcode backwards compatible
I am new to Cocoa and Xcode, but I really do want to learn.

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.