title: iOS - how to make SOAP request & receive the concern response
body: <p>I know htere is lot of stuff available on web for &quot;how to use SOAP in iOS&quot;, but still I failed in doing for following SAOP Request &amp; response. Help is greatly Appreciated.
  I use the simple <code>NSURLConnection</code> for request &amp; response
  SOAP Requst</p>
  <pre><code>POST ???.asmx HTTP/1.1
  Host: ???
  Content-Type: text/xml; charset=utf-8
  Content-Length: length
  SOAPAction: &quot;http://tempuri.org/GetMessages&quot;
  
  &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;soap:Envelope xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
    &lt;soap:Body&gt;
      &lt;GetMessages xmlns=&quot;http://tempuri.org/&quot;&gt;
        &lt;GroupName&gt;string&lt;/GroupName&gt;
        &lt;Date&gt;dateTime&lt;/Date&gt;
      &lt;/GetMessages&gt;
    &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  <p>SOAP Response</p>
  <pre><code>HTTP/1.1 200 OK
  Content-Type: text/xml; charset=utf-8
  Content-Length: length
  
  &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;soap:Envelope xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
    &lt;soap:Body&gt;
      &lt;GetMessagesResponse xmlns=&quot;http://tempuri.org/&quot;&gt;
        &lt;GetMessagesResult&gt;xml&lt;/GetMessagesResult&gt;
      &lt;/GetMessagesResponse&gt;
    &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  <p>Here is the code I wrote for sending the request..</p>
  <pre><code>NSString *soapMessage = [NSString stringWithFormat:
                           @&quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;utf-8\&quot;?&gt;\n&quot;
                           &quot;&lt;soap:Envelope xmlns:xsi=\&quot;http://www.w3.org/2001/XMLSchema-instance\&quot; xmlns:xsd=\&quot;http://www.w3.org/2001/XMLSchema\&quot; xmlns:soap=\&quot;http://schemas.xmlsoap.org/soap/envelope/\&quot;&gt;\n&quot;
                           &quot;&lt;soap:Body&gt;\n&quot;
                           &quot;&lt;GetMessages xmlns=\&quot;http://tempuri.org/\&quot;&gt;\n&quot;
                           &quot;&lt;GroupName&gt;%@&lt;/GroupName&gt;\n&quot;
                           &quot;&lt;Date&gt;%@&lt;/Date&gt;\n&quot;
                           &quot;&lt;/GetMessages&gt;\n&quot;
                           &quot;&lt;/soap:Body&gt;\n&quot;
                           &quot;&lt;/soap:Envelope&gt;\n&quot;
                           , txtfield1.text
                           , textfield2.text
                           ];
  NSLog(@&quot;soapMessage: \n%@&quot;,soapMessage);
  
  NSURL *url = [NSURL URLWithString:@&quot;???.asmx&quot;];
  NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
  NSString *msgLength = [NSString stringWithFormat:@&quot;%d&quot;, [soapMessage length]];
  
  [theRequest addValue: @&quot;text/xml; charset=utf-8&quot; forHTTPHeaderField:@&quot;Content-Type&quot;];
  [theRequest addValue: @&quot;http://tempuri.org/GetMessages&quot; forHTTPHeaderField:@&quot;SOAPAction&quot;];
  [theRequest addValue: msgLength forHTTPHeaderField:@&quot;Content-Length&quot;];
  [theRequest setHTTPMethod:@&quot;POST&quot;];
  [theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
  
  NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
  
  if(theConnection )
      webData = [[NSMutableData data] retain];
  else
      NSLog(@&quot;theConnection is NULL&quot;);
  </code></pre>
  <p>I am getting this error in <code>connectionDidFinishLoading</code></p>
  <pre><code>  &lt;soap:Fault&gt;
       &lt;faultcode&gt;soap:Server&lt;/faultcode&gt;
       &lt;faultstring&gt;Server was unable to process request. ---&amp;gt; SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.&lt;/faultstring&gt;
       &lt;detail /&gt;
    &lt;/soap:Fault&gt;
  </code></pre>
  <p>I referred to <a href="https://stackoverflow.com/questions/5800396/making-a-soap-request-in-iphone">this link</a>
  &amp;  <a href="http://www.icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/" rel="nofollow noreferrer">used the code in this link &amp; modified according to my convenience to make it worked</a></p>
  <p><strong>My question is how to send the request &amp; receive the concern response</strong></p>
  <p><em>Thanks a lot in advance</em></p>