00001
00002
00003
00004
00005
00006
00007
00008
00009 #import "MoodleCallProtocol.h"
00010 #import "WIRemoting.h"
00011
00012 @implementation MoodleCallProtocol
00013
00014 @synthesize async;
00015
00016 - (id) init
00017 {
00018 self = [super init];
00019
00020 if (nil != self) {
00021 async = YES;
00022 }
00023
00024 return self;
00025 }
00026
00027 - (void) adjustRequest:(ASIFormDataRequest *)request
00028 method:(NSString *)method
00029 arguments:(NSDictionary *)arguments
00030 {
00031
00032 [request setURL:
00033 [NSURL URLWithString:@"http://www.webinit.org/srv/soaprest.php"]];
00034
00035 [request setPostValue:method forKey:@"_method"];
00036
00037 for (NSString *key in [arguments allKeys]) {
00038 id object = [arguments objectForKey:key];
00039 if ([object isKindOfClass:[NSArray class]]) {
00040 for (NSString *value in object) {
00041 [request setPostValue:value forKey:[NSString stringWithFormat:@"%@[]", key]];
00042 }
00043 }
00044 else {
00045 [request setPostValue:object forKey:key];
00046 }
00047
00048 }
00049 }
00050
00051 - (BOOL) isAsynchronous
00052 {
00053 return async;
00054 }
00055
00056 @end