I am using RestKit 0.20.0 to work with API (xml).
But when I try to make XML POST request and setup mapping, request body is always null
RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"http://url:4465/paci/v1.0"]];
[RKMIMETypeSerialization registerClass:[RKXMLReaderSerialization class] forMIMEType:@"application/xml"];
objectManager.requestSerializationMIMEType = RKMIMETypeXML;
[objectManager setAcceptHeaderWithMIMEType:RKMIMETypeXML];
Mapping:
RKObjectMapping *createServerMapping = [RKObjectMapping mappingForClass:[NSMutableDictionary class]];
[createServerMapping addAttributeMappingsFromDictionary:@{ @"name": @"name",
@"description": @"description",
@"ramSize": @"ram-size",
}];
RKRequestDescriptor *createServerDescriptor = [RKRequestDescriptor requestDescriptorWithMapping:createServerMapping objectClass:[NSMutableDictionary class] rootKeyPath:@"ve" method:RKRequestMethodPOST];
[objectManager addRequestDescriptor:createServerDescriptor];
Object:
IBCreateServer *createServerRequest = [[IBCreateServer alloc] init];
createServerRequest.name = @"web40";
createServerRequest.description = @"testtest";
createServerRequest.ramSize = @"512";
post Object:
[objectManager postObject:createServerRequest path:@"ve" parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {} failure:^(RKObjectRequestOperation *operation, NSError *error) {}];
And the result of this request is:
request.headers={
Accept = "application/xml";
"Accept-Language" = "en;q=1, fr;q=0.9, de;q=0.8, zh-Hans;q=0.7, zh-Hant;q=0.6, ja;q=0.5";
}
request.body=(null)
Body is always null. What i am doing wrong? This happens only with request, response XML parsing works correctly.
EDIT: if I serialize to json, it works correctly