title: iOS SOAP WCF calling issues - HTTP 415 error
body: <p>I am trying to send SOAP request but it is returning "HTTP 415 unsupported media" error.</p>
  
  <p>below given is my code</p>
  
  <pre><code>NSString *soapMessage = [NSString stringWithFormat:@"&lt;Envelope xmlns=\"http://www.w3.org/2003/05/soap-envelope\"&gt;&lt;Body&gt;&lt;GetCity xmlns=\"http://tempuri.org/\"&gt;&lt;SearchString&gt;&lt;/SearchString&gt;&lt;SearchZone&gt;&lt;/SearchZone&gt;&lt;/GetCity&gt;&lt;/Body&gt;&lt;/Envelope&gt;"];
  
  
  
  NSURL *url=[NSURL URLWithString:@"http://ws.abcxyz.com/abcxyz1/Service1.svc?wsdl"];
  
  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/IService1/GetCity" forHTTPHeaderField:@"SOAPAction"];
  [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
  [theRequest setHTTPMethod:@"POST"];
  [theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
  
  NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
  
  if (theConnection) {
  
      NSMutableData *responseData = [NSMutableData data];
      NSLog(@"success %d", [responseData length]);
  } else {
      NSLog(@"failed");
      //messageTextView.text=@"Failed";
  
  }
  </code></pre>
  
  <p>Please let me know if i need to change anything.</p>