sudzc 101(响应问题)
我相信这对于各位专家来说会非常简单。 SUDZC 已设置,一切似乎都正常工作,但当一个值返回到委托时,它为空。 NSLog 显示了正确的 XML 响应,因此我知道它工作正常,但代码中的值显示为 null。 SUDZC 附带了一个示例程序,这就是它的运行方式。我在网络服务“WhatsYourFavoriteMovie”上创建了一个测试函数,该函数返回“低俗小说”。日志记录清楚地显示了正在返回的该值。为什么最终值是(null)?请帮忙,谢谢。
所以我打电话...
[service WhatsYourFavoriteMovie:self action:@selector(WhatsYourFavoriteMovieHandler:) userid: 1];
然后当网络服务响应时它会转到...
// Handle the response from WhatsYourFavoriteMovie.
- (void) WhatsYourFavoriteMovieHandler: (id) value {
// Handle errors
if([value isKindOfClass:[NSError class]]) {
NSLog(@"%@", value);
return;
}
// Handle faults
if([value isKindOfClass:[SoapFault class]]) {
NSLog(@"%@", value);
return;
}
// Do something with the NSString* result
NSString* result = (NSString*)value;
NSLog(@"WhatsYourFavoriteMovie returned the value: %@", result);
}
但是“值”和“结果”始终为“空”...正如您在下面的 NSLog 输出中看到的那样,它返回“低俗小说” ”在标签中。我哪里出错了?
2012-02-17 17:27:41.487 SudzCExamples[2782:f803] Loading: https://www.mydomain.com/tk_services/tk.asmx
2012-02-17 17:27:41.491 SudzCExamples[2782:f803] <?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="com.mynamespace"><soap:Body><WhatsYourFavoriteMovie>
<userid>1</userid></WhatsYourFavoriteMovie></soap:Body></soap:Envelope>
2012-02-17 17:27:41.497 SudzCExamples[2782:f803]
Applications are expected to have a root view controller at the end of application launch
2012-02-17 17:27:45.947 SudzCExamples[2782:f803]
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body>
<WhatsYourFavoriteMovieResponse xmlns="com.mynamespace">
<WhatsYourFavoriteMovieResult>Pulp Fiction</WhatsYourFavoriteMovieResult>
</WhatsYourFavoriteMovieResponse></soap:Body></soap:Envelope>
2012-02-17 17:27:45.949 SudzCExamples[2782:f803] WhatsYourFavoriteMovie returned the value: (null)"
再次,正如您在日志中看到的那样,它从服务器获取了值“低俗小说”,但日志的最后一行表示它返回了值“null”。请帮我!!谢谢。
I'm sure this will be very simple for you experts. SUDZC is set up and everything seems to work properly but when a value is returned to the delegate, it is null. the NSLog shows the correct XML response, so i know that it is working properly, but the value in the code is showing null. SUDZC comes with a sample program and this is how it runs. i created a test function on the web service "WhatsYourFavoriteMovie" which returns "Pulp Fiction". The logging clearly shows this value being returned. Why is the final value (null)?? Please help, thank you.
so i call...
[service WhatsYourFavoriteMovie:self action:@selector(WhatsYourFavoriteMovieHandler:) userid: 1];
and then when the web service responds it goes to...
// Handle the response from WhatsYourFavoriteMovie.
- (void) WhatsYourFavoriteMovieHandler: (id) value {
// Handle errors
if([value isKindOfClass:[NSError class]]) {
NSLog(@"%@", value);
return;
}
// Handle faults
if([value isKindOfClass:[SoapFault class]]) {
NSLog(@"%@", value);
return;
}
// Do something with the NSString* result
NSString* result = (NSString*)value;
NSLog(@"WhatsYourFavoriteMovie returned the value: %@", result);
}
however "value" and "result" are always 'null'... as you can see in the NSLog output below it is returning "Pulp Fiction" in the tag. Where am i going wrong?
2012-02-17 17:27:41.487 SudzCExamples[2782:f803] Loading: https://www.mydomain.com/tk_services/tk.asmx
2012-02-17 17:27:41.491 SudzCExamples[2782:f803] <?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="com.mynamespace"><soap:Body><WhatsYourFavoriteMovie>
<userid>1</userid></WhatsYourFavoriteMovie></soap:Body></soap:Envelope>
2012-02-17 17:27:41.497 SudzCExamples[2782:f803]
Applications are expected to have a root view controller at the end of application launch
2012-02-17 17:27:45.947 SudzCExamples[2782:f803]
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body>
<WhatsYourFavoriteMovieResponse xmlns="com.mynamespace">
<WhatsYourFavoriteMovieResult>Pulp Fiction</WhatsYourFavoriteMovieResult>
</WhatsYourFavoriteMovieResponse></soap:Body></soap:Envelope>
2012-02-17 17:27:45.949 SudzCExamples[2782:f803] WhatsYourFavoriteMovie returned the value: (null)"
once again, as you can see in the log it got the value "pulp fiction" from the server, but the final line of the log says it returned value 'null'. please help me!! thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我对 Sudzc 生成的代码的 ARC 版本遇到了完全相同的问题,但无论出于何种原因,非 ARC 版本工作正常
更新
查看此 问题报告。我做了第一条评论中建议的更改,ARC 版本运行良好。
I had exactly the same problem with the ARC version of the Sudzc generated code, but for whatever reason the non-ARC version worked fine
UPDATE
Check out this issue report. I made the change suggested in the first comment and the ARC version worked fine.
请尝试将响应记录到 didrecivedata 中。在 SoapRequest.m 类中
然后您就会知道确切的问题是什么。
完成此操作后发布回复,我们将根据该回复为您提供帮助。
Do try to NSLog the response in didrecivedata. in the class SoapRequest.m
Then you will come to know what the exact problem is.
Post the response after doing this,we help will you according to that.
如果您使用的是 ARC 版本,请在 SoapRequest 中将行更改
为
If you are using the ARC version, in SoapRequest, change the line
with