Sudzc iPhone SOAP - 如何使用此库自动生成的数据处理 SOAP 错误?

发布于 2024-10-16 17:01:07 字数 164 浏览 2 评论 0原文

我有一个响应,如果出现异常,它会返回 SOAP 错误。我想处理这个 SOAP 错误。但是,我通过反序列化 SOAP 响应获得的响应没有 SOAP 错误。

我使用 Sudzc 库为我的 Web 服务生成目标 C 代码。

帮助将不胜感激。

谢谢,

普里亚

I have a response, which returns SOAP fault in case of exception. I want to handle this SOAP Fault. But, the response I get by deserializing the SOAP response does not have a SOAP Fault.

I have used Sudzc Library to generate the objective C code for my web services.

Help will be appreciated.

Thanks,

Priya

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

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

发布评论

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

评论(2

撞了怀 2024-10-23 17:01:07

与 Sudzc 捆绑在一起的 SoapRequest.m 中似乎存在一个错误。

具体来说,如果您查看该

- (void)connectionDidFinishLoading:(NSURLConnection *)connection;

方法并导航到以下代码:

id output = nil;
SoapFault* fault = [SoapFault faultWithXMLDocument: doc];

if([fault hasFault]) {
    if(self.action == nil) {
        [self handleFault: fault];
    } else {
        if(self.handler != nil && [self.handler respondsToSelector: self.action]) {
            [self.handler performSelector: self.action withObject: output];
        } else {
            NSLog(@"SOAP Fault: %@", fault);
        }
    }
}

您可以看到,当返回到处理程序时,输出始终为 nil。

要解决此问题,您只需将 SoapFault 而不是输出返回到处理程序,如下所示:

...
[self.handler performSelector: self.action withObject: fault];
...

There seems to be a bug in the SoapRequest.m that is bundled with Sudzc.

Specifically, if you take a look at the

- (void)connectionDidFinishLoading:(NSURLConnection *)connection;

method and navigate to the following bit of code:

id output = nil;
SoapFault* fault = [SoapFault faultWithXMLDocument: doc];

if([fault hasFault]) {
    if(self.action == nil) {
        [self handleFault: fault];
    } else {
        if(self.handler != nil && [self.handler respondsToSelector: self.action]) {
            [self.handler performSelector: self.action withObject: output];
        } else {
            NSLog(@"SOAP Fault: %@", fault);
        }
    }
}

You can see that output will always be nil when returned to the handler.

To fix this issue, you can simply return the SoapFault instead of the output to your handler like so:

...
[self.handler performSelector: self.action withObject: fault];
...
栩栩如生 2024-10-23 17:01:07

在你的 Sudzc 返回处理程序方法中,你可以 [idOfSoapObject isKindOfClass:[SoapFault class]]

如果你已经这样做了,那么我建议打开日志记录:你的服务将有一个 .logging(BOOL)财产。这将记录完整的肥皂请求和响应。您可以在此处手动检查响应是否有错误。

In your Sudzc return Handler Method, you can [idOfSoapObject isKindOfClass:[SoapFault class]]

If you are already doing this, then I would suggest turning Logging on: your service will have a .logging(BOOL) property. This will log the full soap requests and responses. Here you can check the response manually for a fault.

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