title: iOS call soap functions in thread
body: <p>guys</p>
  
  <p>I'm a new iOS developer, I'm having a problem when calling soap functions in new thread.</p>
  
  <p>Here is more details:</p>
  
  <p>I have a function calling soap web service:</p>
  
  <pre><code>WebService *webService = [[[WebService alloc]init]retain];
  [webService getUser:self action:@selector(getUserHandler) userName: usnm  encPassword: pswd];
  </code></pre>
  
  <p>This function is simply generated from sudzc.com(Great Website! Thanx!)
  simply calling this function I can get </p>
  
  <pre><code>&lt;user&gt;&lt;username&gt;XXX&lt;/username&gt;&lt;userStatus&gt;XXX&lt;/userStatus&gt;&lt;companyCode&gt;XXX&lt;/companyCode&gt;&lt;password&gt;XXX&lt;/password&gt;&lt;/user&gt;
  </code></pre>
  
  <p>back from webservice. and my getUserHandler will work perfectly.</p>
  
  <p>but if I want to call the webservice in a thread like this:</p>
  
  <pre><code>[NSThread detachNewThreadSelector:@selector(myMethod) toTarget:self withObject:nil];
  
  -(void)myMethod
  {
      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
      NSLog(@"!, %@,%@",usnm,pswd);
      WebService *webService = [[[WebService alloc]init]retain];
      [webService getUser:self action:@selector(getUserHandler) userName: usnm  encPassword: pswd];
      [pool drain];
  }
  </code></pre>
  
  <p>I don't seem to get the returnxml, and it seems the getUserHandler never starts(I put a NSLog in the getUserHandler, but it won't print this time).</p>
  
  <p>I got no idea why is this happening, </p>
  
  <p>any hints are welcome!</p>
  
  <p>Thanx!</p>