iPhone 上的 Web 服务到底哪里需要异常处理
我是一名新的 iPhone 开发人员,对网络服务也完全陌生。我使用 http://www.sudzc.com/ 为我的 wsdl 开发 obj-c 代码。我需要知道我到底需要在代码中哪里处理异常?或者由 sudz 本身生成的代码负责异常处理本身?
I am a new iPhone developer and totally new to web-services as well. I had used http://www.sudzc.com/ to develop my obj-c code for my wsdl. I need to know that where exactly i need to handle exceptions in this code? Or the code generated by sudz itself takes care of the exception handling itself?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看为您的 Web 服务生成的示例代码。它们为您提供错误处理程序的通用布局。应该看起来像这样:
// 处理来自 webserviceConnection 的响应。
(void)webserviceConnectionHandler:(BOOL)值{
// 对 BOOL 结果做一些事情
NSLog(@"webserviceConnection returned the value: %@", [NSNumber numberWithBool:value]);
}
Look at the example code generated for your web service. They give you the generic layout for the error handlers. Should look something like this:
// Handle the response from webserviceConnection.
(void) webserviceConnectionHandler: (BOOL) value {
// Do something with the BOOL result
NSLog(@"webserviceConnection returned the value: %@", [NSNumber numberWithBool:value]);
}
通常,WSDL 中的代理类具有选择器方法,当您执行某些操作/方法调用时,会调用这些选择器方法。因此,您只需检查要调用什么方法(从服务级别)并在类中实现选择器方法。
Generally the proxy classes from the WSDL has selector methods which gets called,when you do some operation/method call. So you just need to check it out what method (from service level) you are going to call and implement the selector method in your class.