为什么异步 SOAP Web 服务调用不起作用

发布于 2024-10-19 07:27:08 字数 827 浏览 2 评论 0原文

我使用 WSMakeStubs(在开发工具中)生成用于访问 SOAP Web 服务的存根代码。我对对象进行的调用当前被阻止。当我尝试使用异步调用时,没有任何反应,我确信这与我对运行循环的理解有关。我初始化一个对象并尝试将其调度到运行循环上,如下所示:

BeginPartnerSession *call = [[BeginPartnerSession alloc] init];
[call setParameters:kPartnerID in_Password:kPartnerPassword];
[call setCallBack:self selector:@selector(sessionIDRequestDidFinish:)];
[call scheduleOnRunLoop:[NSRunLoop currentRunLoop] mode:NSDefaultRunLoopMode];
[call release];

用于调度运行循环的存根调用如下所示:

- (void) scheduleOnRunLoop:(NSRunLoop*) runloop mode:(NSString*) mode
{
  WSMethodInvocationScheduleWithRunLoop([self getRef], [runloop getCFRunLoop], (CFStringRef) mode);
}

对 [self getRef] 的调用返回一个已设置回调的调用对象。然后回调应该调用我的目标和选择器,但在使用运行循环调用 Schedule 后它永远不会到达该断点。需要对运行循环调度进行哪些更改才能使其正常工作?

同步调用工作正常,所以我很确定这不是服务器问题。

I used WSMakeStubs (in the dev tools) to generate stub code for accessing a SOAP web service. The calls I make to the object just block currently. When I try to use the async calls, nothing happens and I'm sure it has to do with my understanding of run loops. I initialize an object and try to schedule it on a run loop like this:

BeginPartnerSession *call = [[BeginPartnerSession alloc] init];
[call setParameters:kPartnerID in_Password:kPartnerPassword];
[call setCallBack:self selector:@selector(sessionIDRequestDidFinish:)];
[call scheduleOnRunLoop:[NSRunLoop currentRunLoop] mode:NSDefaultRunLoopMode];
[call release];

The stub call for scheduling on the run loop looks like this:

- (void) scheduleOnRunLoop:(NSRunLoop*) runloop mode:(NSString*) mode
{
  WSMethodInvocationScheduleWithRunLoop([self getRef], [runloop getCFRunLoop], (CFStringRef) mode);
}

The call to [self getRef] returns an invocation object that has set the callback. The callback is then supposed to call out to my target and selector, but it never hits that break point after calling schedule with run loop. What needs to change in the run loop scheduling to get it to work correctly?

Synchronous calls work fine, so I'm pretty sure it's not a server issue.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

和影子一齐双人舞 2024-10-26 07:27:08

我最终将其分解为一个单独的项目,在那里我可以隔离问题。异步调用在那里工作得很好,这让我怀疑运行循环。事实证明,这个问题与我将其作为 iPhoto 插件运行有关。我只是更改了运行循环模式,因此调用如下所示:

[call scheduleOnRunLoop:[NSRunLoop currentRunLoop] mode:NSRunLoopCommonModes];

然后调用了回调。瞧!

I finally broke this out into a separate project where I could isolate the problem. The async call worked just fine there which made the runloop suspect to me. Turns out the issue had to do with the fact that I am running this as a plugin for iPhoto. I simply changed the runloop mode so the call looked like this:

[call scheduleOnRunLoop:[NSRunLoop currentRunLoop] mode:NSRunLoopCommonModes];

Then the callback got called. Voila!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文