这是我的SoapRequest:
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];
}
}
您能否帮我解决这个问题,以获得理想的结果:DMMDmdInfo对象的NSMutableArray?
答案 0 :(得分:0)
以下代码对我有用,我们需要为SoapArray
param指定deserializeTo
对象
SoapRequest* _request = [SoapRequest create: _target action: _action service: self soapAction: @"" postData: _envelope deserializeTo: [[[SoapArray alloc] init] autorelease]];
答案 1 :(得分:-1)
虽然我仍然在研究它,但在我的项目中,我使用以下代码来获取返回对象的NSMutableArray。我也对SoapRequest.m进行了一些调整,但你应该先尝试这个小小的改动,看看它是否有效
SoapRequest* _request = [SoapRequest create: _target action: _action service: self soapAction: @"" postData: _envelope deserializeTo: [[[NSMutableArray alloc] init] autorelease]];