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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:43:07+00:00 2026-05-20T09:43:07+00:00

I am getting the following exception when adding an xml body to a POST

  • 0

I am getting the following exception when adding an xml body to a POST request. I get the same exception when doing the same with GET. Any help would be appreciated.

Code

- (IBAction)buttonTapped:(id)sender {
NSLog(@"buttonTapped");

//Creating the request
NSMutableURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://192.168.0.1:9081/Transport/services/DriverService"] cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval: 30.0];
[ request setHTTPMethod: @"POST"];
//creating connection and sending it
NSURLConnection *connection = [ [NSURLConnection alloc] initWithRequest:request delegate:self];

NSString *xmlString = @"<Driver type=\"GetName\"><DriverID>1</DriverID></Driver>";

[request setHTTPBody:[xmlString 
                      dataUsingEncoding:NSUTF8StringEncoding]];

//checking if connection is good
if (connection){
    NSLog (@"Connection successfull!");
    self.responseData = [NSMutableData data];
}
else
{
    NSLog (@"Connection failed");
}
}

Exception

Exception:
2011-03-02 09:22:12.055 XML[1125:207] buttonTapped

2011-03-02 09:22:12.056 XML[1125:207] -[NSURLRequest setHTTPMethod:]: unrecognized selector sent to instance 0x4b1a970

2011-03-02 09:22:12.057 XML[1125:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSURLRequest setHTTPMethod:]: unrecognized selector sent to instance 0x4b1a970'

*** Call stack at first throw:
(
    0   CoreFoundation                      0x00dafbe9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x00f045c2 objc_exception_throw + 47
    2   CoreFoundation                      0x00db16fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    3   CoreFoundation                      0x00d21366 ___forwarding___ + 966
    4   CoreFoundation                      0x00d20f22 _CF_forwarding_prep_0 + 50
    5   XML                                 0x00002bc4 -[XMLViewController buttonTapped:] + 164
    6   UIKit                               0x002b8a6e -[UIApplication sendAction:to:from:forEvent:] + 119
    7   UIKit                               0x003471b5 -[UIControl sendAction:to:forEvent:] + 67
    8   UIKit                               0x00349647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
    9   UIKit                               0x003481f4 -[UIControl touchesEnded:withEvent:] + 458
    10  UIKit                               0x002dd0d1 -[UIWindow _sendTouchesForEvent:] + 567
    11  UIKit                               0x002be37a -[UIApplication sendEvent:] + 447
    12  UIKit                               0x002c3732 _UIApplicationHandleEvent + 7576
    13  GraphicsServices                    0x016e5a36 PurpleEventCallback + 1550
    14  CoreFoundation                      0x00d91064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    15  CoreFoundation                      0x00cf16f7 __CFRunLoopDoSource1 + 215
    16  CoreFoundation                      0x00cee983 __CFRunLoopRun + 979
    17  CoreFoundation                      0x00cee240 CFRunLoopRunSpecific + 208
    18  CoreFoundation                      0x00cee161 CFRunLoopRunInMode + 97
    19  GraphicsServices                    0x016e4268 GSEventRunModal + 217
    20  GraphicsServices                    0x016e432d GSEventRun + 115
    21  UIKit                               0x002c742e UIApplicationMain + 1160
    22  XML                                 0x000028dc main + 102
    23  XML                                 0x0000286d start + 53
)
terminate called after throwing an instance of 'NSException'
  • 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-20T09:43:08+00:00Added an answer on May 20, 2026 at 9:43 am
    NSMutableURLRequest *request = [NSURLRequest requestWithURL:...
    

    should be

    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:...
    

    Although you declare request to have NSMutableURLRequest type, you create an instance of NSURLRequest class, which does not responds to -setHTTPMethod: selector.

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

Sidebar

Related Questions

I am getting the following exception while adding data into database: org.hibernate.HibernateException: The database
I am getting the following exception when calling any of my Mapper.Map methods. Inheritance
hey guys, i'm getting an exception on the following inner exception: {Value cannot be
I am getting the following error when I post back a page from the
I am getting the following exception on a call to Html.RenderPartial : The model
I am getting the following exception. There are two records in the table and
I've been getting the following exception when trying to send an e-mail using System.Net.Mail:
After upgrading to Android 2.3.4, I am getting following exception: javax.net.ssl.SSLException: Read error: ssl=0x*:
I'm gettting the following exception when performing an insert to an Oracle Databse using
I getting the following error when I try to connect to my server app

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.