如何使用wsdl 2 objc ios捕获Web服务调用响应

时间:2012-07-23 17:50:11

标签: ios wsdl2objc

我正在开发一个使用WSDL服务器的应用程序。我已经从wsdl2objc生成了代码。我已经完成了创建soap envelop请求标头并即将启动服务器调用。有人可以建议我如何捕获我的服务器调用的响应。是否有任何委托方法来捕获响应,如生成的sudzc WSDL代码中的onload()方法?

1 个答案:

答案 0 :(得分:0)

在这里你可以找到处理响应的示例编码:

- (IBAction)buttonPressed:(id)sender {
  LocalTimeSoapBinding *binding = [[LocalTime LocalTimeSoapBinding] initWithAddress:@"http://www.ripedevelopment.com/webservices/LocalTime.asmx"];
  binding.logXMLInOut = YES;  // to get logging to the console.

  LocalTime_LocalTimeByZipCode *request = [[LocalTime_LocalTimeByZipCode alloc] init];
  request.ZipCode = @"29687";  // insert your zip code here.

  LocalTimeSoapBindingResponse *resp = [binding LocalTimeByZipCodeUsingParameters:request];
  for (id mine in resp.bodyParts)
  {
          if ([mine isKindOfClass:[LocalTime_LocalTimeByZipCodeResponse class]])
          {
                  field.text = [mine LocalTimeByZipCodeResult];
          }
  }
}