title: Post Data through json webservices in iphone
body: <p>I want to post data through json webservicesmy on button click Action code is:</p>
  <pre><code>-(IBAction)login:(id)sender {
      NSString *newurlString = [NSString StringWithFormat:@&quot;{\&quot;name\&quot;:\&quot;asit\&quot;,\&quot;email\&quot;:\&quot;m.kulkarni@easternenterprise.com\&quot;,\&quot;businessType\&quot;:\&quot;1\&quot;,\&quot;score\&quot;:30}&quot;];
      NSString * url = @&quot;http://www.nieuwe-dag.nl/mobile_be/public/?action=saveScore&quot;;
     
      NSData *postData = [newurlString dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
  
      NSString *postLength = [NSString stringWithFormat:@&quot;%d&quot;, [postData length]];
      NSLog(@&quot;urlString::%@&quot;,newurlString);
      NSLog(@&quot;postLength::%@&quot;,postLength);
  
      NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url] cachePolicy:NSURLCacheStorageNotAllowed timeoutInterval:300];
      [request setHTTPMethod:@&quot;POST&quot;];
      [request setValue:postLength forHTTPHeaderField:@&quot;Content-Length&quot;];
      [request setValue:@&quot;application/json&quot; forHTTPHeaderField:@&quot;Content-Type&quot;];
      [request setHTTPBody:postData];
  
      NSURLConnection *theConnection =[[NSURLConnection alloc] initWithRequest:request delegate:self];
  
  
      if( theConnection ) {
          webData = [[NSMutableData data] retain];
      }
      else {
          NSLog(@&quot;theConnection is NULL&quot;);
      }
  }
  </code></pre>
  <p><strong>And response on console is:</strong></p>
  <blockquote>
  <p>[Session started at 2011-07-25 12:36:48 +0530.] 2011-07-25
  12:36:48.860 DepartmentalStoreAdmin[2490:207] Could not load the
  &quot;header.png&quot; image referenced from a nib in the bundle with identifier
  &quot;com.easternenterprise.dag&quot; 2011-07-25 12:36:48.864
  DepartmentalStoreAdmin[2490:207] Could not load the &quot;leher.png&quot; image
  referenced from a nib in the bundle with identifier
  &quot;com.easternenterprise.dag&quot; 2011-07-25 12:36:50.708
  DepartmentalStoreAdmin[2490:207]
  urlString::{&quot;name&quot;:&quot;asit&quot;,&quot;email&quot;:&quot;m.kulkarni@easternenterprise.com&quot;,&quot;businessType&quot;:&quot;1&quot;,&quot;score&quot;:30}
  2011-07-25 12:36:50.709 DepartmentalStoreAdmin[2490:207]
  postLength::88 2011-07-25 12:36:52.376
  DepartmentalStoreAdmin[2490:207] DONE. Received Bytes: 52 2011-07-25
  12:36:52.377 DepartmentalStoreAdmin[2490:207]</p>
  <p>THEXML {&quot;result&quot;:&quot;ERROR&quot;,&quot;errors&quot;:[&quot;Name cannot be empty&quot;]}</p>
  </blockquote>
  <p>I don't have any idea why it is not post.</p>