Search code examples
iphoneiossoapwsdlsudzc

Please suggest me possible correction in code (Iphone app development)


I got the following generated code from sudzC and the generated code showing error. I corrected some of errors and now getting in following line of code.

.h file

- (SoapRequest*) CreateAdvocacyData: (id) target action: (SEL) action oNode: (nil) oNode;

.m file

- (SoapRequest*) CreateAdvocacyData: (id) _target action: (SEL) _action oNode: (nil) oNode
        {
        NSMutableArray* _params = [NSMutableArray array];

        [_params addObject: [[[SoapParameter alloc] initWithValue: oNode forName: @"oNode"] autorelease]];
        NSString* _envelope = [Soap createEnvelope: @"CreateAdvocacyData" forNamespace: self.namespace withParameters: _params withHeaders: self.headers];
        SoapRequest* _request = [SoapRequest create: _target action: _action service: self soapAction: @"http://www.avectra.com/2005/CreateAdvocacyData" postData: _envelope deserializeTo: nil];
        [_request send];
        return _request;
    }

called from other file

[service CreateAdvocacyData:self action:@selector(CreateAdvocacyDataHandler:) oNode: [[ alloc] init]];

These all are generated code by sudzc. I have doubt:

  • Please suggest me changes in this line of code.

  • Please explain meaning of action:@selector(CreateAdvocacyDataHandler:)

  • Can i pass in oNode:nil instead of [[ alloc] init] (error).


Solution

  • There were some some problems in generated code and I corrected it (form sudzc.com).

    - (SoapRequest*) CreateAdvocacyData: (id) target action: (SEL) action oNode: (nil) oNode;
    

    modified to

    - (SoapRequest*) CreateAdvocacyData: (id) target action: (SEL) action oNode: (id) oNode;
    

    I understood the meaning of SEL (thanks vittal) http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/objectivec/Chapters/ocSelectors.html

    and I solved the third issue by passing nil instead of [[ alloc]init]