KanikaVarma / sudzc

Automatically exported from code.google.com/p/sudzc
0 stars 0 forks source link

Header Support Suggestion #26

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Suggestion from an Objective-C perspective :

SudzC WSDL to Objective-C generates header definition class files such as 
SomeSuchHeader.h/.m. These header definitions objects don't have the necessary 
methods to supply dictionaries for the SoapService header object.

Include in xxxHeader.h/.m or for all SoapObject classes such as in the example 
below generated for the particular object.

- (NSDictionary*) serializeDictionary {
    return [self serializeDictionary: @"xxxHeader"];
}

- (NSDictionary*) serializeDictionary: (NSString*) nodeName {
    NSDictionary* v = [self serializeAttributesDictionary];
    return [[NSDictionary dictionaryWithObject:v forKey:nodeName] autorelease];
}

- (NSDictionary*) serializeAttributesDictionary {
    NSMutableDictionary* d = [[[NSMutableDictionary alloc] init] autorelease];

    if (self.ApplicationDomainName != nil) 
        [d setObject:self.ApplicationName forKey:@"@ApplicationName"];

    return [[NSDictionary dictionaryWithDictionary:d] autorelease];                    
}

Original issue reported on code.google.com by lumin...@gmail.com on 20 Apr 2011 at 3:55

GoogleCodeExporter commented 9 years ago
This example did not include Elements as the class I used didn't require it. It 
needs a little bit of work to add element objects to the resulting dictionary. 

- (NSDictionary*) serializeElementsDictionary {
    NSMutableDictionary* d = [[[NSMutableDictionary alloc] init] autorelease];
    if (self.ElementId != nil)
        [d setObject:self.ElementId forKey:@"ElementId"];
    return [NSDictionary dictionaryWithDictionary:d];
}

- (NSDictionary*) serializeDictionary: (NSString*) nodeName {
    NSDictionary* v = [self serializeAttributesDictionary];
    NSMutableDictionary* d = [[NSMutableDictionary dictionaryWithObject:v forKey:nodeName] autorelease];

    NSDictionary* e = [self serializeElementsDictionary];

    for (id key in [e allKeys])
        [d setObject:[e objectForKey:key] forKey:key];

    return [NSDictionary dictionaryWithDictionary:d];
}

Original comment by lumin...@gmail.com on 20 Apr 2011 at 4:09