title: How to send an xml as a string in iphone sdk?
body: <p>I am trying to call a web servive in which there is xml paramater but when i run the code the web service call is not made but when i use some random string as a paramater then the web service gets called.Please tell me what is wrong with my xml or is there other way to pass xml.</p>
  
  <pre><code>    NSString *xml=[NSString stringWithFormat:@"&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;&lt;R&gt;&lt;Root&gt;&lt;CriteriaID&gt;11&lt;/CriteriaID&gt;&lt;Rating/&gt;&lt;/Root&gt;&lt;Root&gt;&lt;CriteriaID&gt;10&lt;/CriteriaID&gt;&lt;Rating/&gt;&lt;/Root&gt;&lt;Root&gt;&lt;CriteriaID&gt;9&lt;/CriteriaID&gt;&lt;/Root&gt;&lt;Root&gt;&lt;CriteriaID&gt;8&lt;/CriteriaID&gt;&lt;Rating/&gt;&lt;/Root&gt;&lt;Root&gt;&lt;CriteriaID&gt;7&lt;/CriteriaID&gt;&lt;Rating/&gt;&lt;/Root&gt;&lt;Root&gt;&lt;CriteriaID&gt;6&lt;/CriteriaID&gt;&lt;Rating/&gt;&lt;/Root&gt;&lt;/R&gt;"];
  
      NSString *soapMsg = [NSString stringWithFormat:@"&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n"
                           "&lt;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/\"&gt;\n"
                           "&lt;soap:Body&gt;\n"
                           "&lt;FullWomPrintsInsert xmlns=\"http://tempuri.org/\"&gt;\n"
                           "&lt;xmlDoc&gt;%@&lt;/xmlDoc&gt;"
                           "&lt;/FullWomPrintsInsert&gt;"
                           "&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;",xml];
      NSLog(@"SoapMsg=%@",soapMsg);
  
  
  
  
      NSString *club_url = [NSString stringWithFormat:@"http://abc"];
  
      NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:club_url]];
  
  
      NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMsg length]];
      NSLog(@"Message Length..%@",msgLength);
  
      [theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
      [theRequest addValue: @"http://tempuri.org/FullWomPrintsInsert" forHTTPHeaderField:@"SOAPAction"];
      [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
      [theRequest setHTTPMethod:@"POST"];
      [theRequest setHTTPBody: [soapMsg dataUsingEncoding:NSUTF8StringEncoding]];
  
      NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
  
  
      if( theConnection )
      {
          webData = [[NSMutableData data] retain];
  
  
  
      }
      else
      {
          NSLog(@"theConnection is NULL");
      }
  </code></pre>