0

这是我的肥皂请求:

SoapRequest* _request = [SoapRequest create: _target action: _action service: self soapAction: @"" postData: _envelope deserializeTo: /*[[DMDDmdInfo alloc] autorelease]*/ [NSMutableArray array]];

我应该收到 DMDDmdInfo 对象的 NSMutableArray。相反,我收到 NSDictionaries 的 NSMutableArray。

这就是我在 SoapRequest:connectionDidFinishLoading 中的内容:

CXMLNode* element = [[Soap getNode: [doc rootElement] withName: @"Body"] childAtIndex:0];
    if(deserializeTo == nil) {
        output = [Soap deserialize:element];
    } else {
        if([deserializeTo respondsToSelector: @selector(initWithNode:)]) {
            //element = [element childAtIndex:0];
            output = [deserializeTo initWithNode: element];
        } else {
            NSString* value = [[[element childAtIndex:0] childAtIndex:0] stringValue];
            output = [Soap convert: value toType: deserializeTo];
        }
    }

您能否帮我解决这个问题,以获得所需的结果:NSMutableArray of DMDDmdInfo objects?

4

2 回答 2

0

以下代码对我有用,我们需要为param指定SoapArray对象deserializeTo

SoapRequest* _request = [SoapRequest create: _target action: _action service: self soapAction: @"" postData: _envelope deserializeTo: [[[SoapArray alloc] init] autorelease]];
于 2012-09-05T07:16:38.210 回答
-1

虽然我仍在努力,但在我的项目中,我使用以下代码来获取返回对象的 NSMutableArray。我还对 SoapRequest.m 做了一些调整,但你应该先尝试一下这个小改动,看看它是否有效

SoapRequest* _request = [SoapRequest create: _target action: _action service: self soapAction: @"" postData: _envelope deserializeTo: [[[NSMutableArray alloc] init] autorelease]];
于 2012-06-05T10:18:03.833 回答