title: transforming SOAP response into NSString
body: <pre><code>NSString *GetExRequest=[NSString stringWithFormat:
                          @"&lt;?xmlversion=\"1.0\"encoding=\"utf-8\"?&gt;\n"
                          "&lt;soap:Envelopexmlns:xsi=\"http://www.w3.org/2001/XMLSchemainstance\"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"&gt;\n"
                          "&lt;soap:Body&gt;\n"
                          "&lt;GetEXRatexmlns=\"Web Services\"&gt;\n"
                          "&lt;AGENT_CODE&gt;xyzzyx&lt;/AGENT_CODE&gt;\n"
                          "&lt;USER_ID&gt;12345689&lt;/USER_ID&gt;\n"
                          "&lt;PASSWORD&gt;dkasdja&lt;/PASSWORD&gt;\n"
                          "&lt;AGENT_SESSION_ID&gt;xyz1234&lt;/AGENT_SESSION_ID&gt;\n"
                          "&lt;TRANSFERAMOUNT&gt;1000&lt;/TRANSFERAMOUNT&gt;\n"
                          "&lt;PAYMENTMODE&gt;c&lt;/PAYMENTMODE&gt;\n"
                          "&lt;CALC_BY&gt;p&lt;/CALC_BY&gt;\n"
                          "&lt;PAYOUT_AGENT_ID&gt;20100008&lt;/PAYOUT_AGENT_ID&gt;\n"
                          "&lt;PAYOUT_COUNTRY&gt;Bangladesh&lt;/PAYOUT_COUNTRY&gt;\n"
                          "&lt;/GetEXRate&gt;\n"
                          "&lt;/soap:Body&gt;\n"
                          "&lt;/soap:Envelope&gt;\n"];
  NSLog(@"%@",GetExRequest);
  NSURL *url = [NSURL URLWithString:@"https://www.prabhuusa.com/SendWsv2/txnservice.asmx?wsdl"];
  NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
  NSString *msgLength = [NSString stringWithFormat:@"%d", [GetExRequest length]];
  [theRequest addValue:@"www.prabhuusa.com" forHTTPHeaderField:@"Host"];
  [theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
  [theRequest addValue: @"WebServices/GetEXRate" forHTTPHeaderField:@"SOAPAction"];
  [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
  [theRequest setHTTPMethod:@"POST"];
  [theRequest setHTTPBody: [GetExRequest dataUsingEncoding:NSUTF8StringEncoding]];
  
  NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
  
      if( theConnection )
  {
      webData = [[NSMutableData data] retain];
  }
  else
  {
      NSLog(@"theConnection is NULL");
  }
  </code></pre>
  
  <p>I am trying to consume this WSDL definition by sending this SOAP request. I wanted to store the response onto a string and the parse it. </p>
  
  <pre><code>-(void)connectionDidFinishLoading:(NSURLConnection *)connection
  {
      NSLog(@"DONE. Received Bytes: %d", [_webData length]);
      NSString *theXML = [[NSString alloc] initWithBytes: [_webData mutableBytes] length:[_webData length] encoding:NSUTF8StringEncoding];
      NSLog(@"WEBDATA::: %@",theXML);
  }
  </code></pre>
  
  <p>But the Response string is blank. I checked this webservice with the SOAP request I sent using SOAP Client and received a XML response.. but i could not get a response in objective C. Please find me a solution</p>
  
  <p>I have this in my didRecieveResponse and didRecieveData methods</p>
  
  <pre><code>-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
  {
  
      [_webData setLength: 0];
  }
  
  -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data  
  { 
  [_webData appendData:data];
  }
  </code></pre>