title: How can you use AFNetworking or STHTTPRequest to make a request of a SOAP web service?
body: <p>I am able to use an <code>NSMutableURLRequest</code> with an <code>NSURLConnection</code> to connect to a SOAP web service, as follows:</p>
  
  <pre><code>NSString *soapMessage = [NSString stringWithFormat:@"&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;"
                           "&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;"
                           "&lt;soap:Body&gt;"
                           "&lt;CelsiusToFahrenheit xmlns=\"http://www.w3schools.com/webservices/\"&gt;"
                           "&lt;Celsius&gt;140.0&lt;/Celsius&gt;"
                           "&lt;/CelsiusToFahrenheit&gt;"
                           "&lt;/soap:Body&gt;"
                           "&lt;/soap:Envelope&gt;"];
  
  NSData *soapData = [soapMessage dataUsingEncoding:NSUTF8StringEncoding];
  NSURL *url = [NSURL URLWithString:@"http://w3schools.com/webservices/tempconvert.asmx"];
  NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
  NSString *msgLength = [NSString stringWithFormat:@"%lu", (unsigned long)[soapMessage length]];
  
  [theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
  [theRequest addValue: @"http://www.w3schools.com/webservices/CelsiusToFahrenheit" forHTTPHeaderField:@"SOAPAction"];
  [theRequest addValue:@"www.w3schools.com" forHTTPHeaderField:@"Host"];
  [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
  [theRequest setHTTPMethod:@"POST"];
  [theRequest setHTTPBody:soapData];
  </code></pre>
  
  <p>How could I do the same using <a href="https://github.com/AFNetworking/AFNetworking" rel="nofollow">AFNetworking</a> or <a href="https://github.com/nst/STHTTPRequest" rel="nofollow">STHTTPRequest</a>?</p>