iPhone 中的其余 Web 服务
我现在有问题。我需要将 transactionID 和用户密码传递给休息服务,并且它应该返回 true/false 值(以 XML 格式)。然而,它一直在返回我(空)..我完全迷失了,请帮忙。
NSString *urlString = [NSString stringWithFormat:@"https://10.124.128.93:8443/axis2/services/C3WebService/completeWithdrawal Transaction?transactionId=%@&password=%@", _transactionID.text, _userPassword.text];
NSURL *url = [[NSURL alloc] initWithString:urlString];
NSString *result = [[NSString alloc] initWithContentsOfURL:url];
NSLog(@"%@",result );
我的结果不断地返回空值。我如何从这里继续?
I have a problem now. I need to pass an transactionID and an user password to a rest service and it is suppose to return me a true/false value (in XML format). However, it is consistently returning me (null).. I am totally lost some one please help.
NSString *urlString = [NSString stringWithFormat:@"https://10.124.128.93:8443/axis2/services/C3WebService/completeWithdrawal Transaction?transactionId=%@&password=%@", _transactionID.text, _userPassword.text];
NSURL *url = [[NSURL alloc] initWithString:urlString];
NSString *result = [[NSString alloc] initWithContentsOfURL:url];
NSLog(@"%@",result );
My result is constantly returning me null. How do i continue from here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
考虑使用 NSURLConnection,它具有结果回调和获取详细错误详细信息的回调。它也不会在 UI 线程上执行(在请求期间不会挂起 UI)。
然后你可以实现委托方法来获取错误、数据和其他详细信息:
Consider using NSURLConnection which has a callback for the result and also a callback to get detailed error details. It als doesn't execute on the UI thread (doesn't hang UI during the request).
Then you can implement the delegate methods to get the error, the data and other details:
您可以尝试使用“initWithContentsOfURL:encoding:error:”代替并检查“error”。另外,使用 Charles 或其他 http 嗅探器并将结果与直接浏览器请求进行比较(您是否在浏览器中检查结果?)
You might try using "initWithContentsOfURL:encoding:error:" instead and check "error". Also, use Charles or other http sniffer and compare results to a straight browser request ( did you check results in a browser?)