title: How to send/receive soap object with objective-c for ipad
body: <p>I have been trying to write a objective-c application for ipad to send/receive soap web service. I have written a code but it gives an error. the webservice is working online.</p>
  
  <p>here is my code,</p>
  
  <pre><code>-(IBAction)invokeService
  {
  
      [txt1 resignFirstResponder];
  
      NSString *soapFormat = [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;GetUserList xmlns=\"http://tempuri.org/\" /&gt;\n"
                      "&lt;/soap:Body&gt;\n"
                      "&lt;/soap:Envelope&gt;\n"];
  
  
      NSLog(@"The request format is %@",soapFormat);
  
      NSURL *locationOfWebService = [NSURL URLWithString:@"http://servicing2.rotanet.com/service1.asmx"];
  
      NSLog(@"web url = %@",locationOfWebService);
  
      NSMutableURLRequest *theRequest = [[NSMutableURLRequest alloc]initWithURL:locationOfWebService];
  
      NSString *msgLength = [NSString stringWithFormat:@"%d",[soapFormat length]];
  
      [theRequest addValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
      [theRequest addValue:@"GetUserList" forHTTPHeaderField:@"SOAPAction"];
      [theRequest addValue:msgLength forHTTPHeaderField:@"Content-Length"];
      [theRequest setHTTPMethod:@"POST"];
      //the below encoding is used to send data over the net
      [theRequest setHTTPBody:[soapFormat dataUsingEncoding:NSUTF8StringEncoding]];
  
  
      NSURLConnection *connect = [[NSURLConnection alloc]initWithRequest:theRequest delegate:self];
  
      if (connect) {
          webData = [[NSMutableData alloc]init];
          startActivityIndicator;
      }
      else {
          NSLog(@"No Connection established");
      }
  }
  </code></pre>
  
  <p>I get this error message</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;soap:Envelope    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;soap:Body&gt;&lt;soap:Fault&gt;  &lt;faultcode&gt;soap:Client&lt;/faultcode&gt;&lt;faultstring&gt;System.Web.Services.Protocols.SoapException:  Server did not recognize the value of HTTP Header SOAPAction: GetUserList.
  at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
  at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
  at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
  at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)
  at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean&amp;amp; abortProcessing)  &lt;/faultstring&gt;&lt;detail /&gt;&lt;/soap:Fault&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>what am I doing wrong?</p>