rt300@29: // rt300@29: // ServerComms.m rt300@29: // sonicZoom rt300@29: // rt300@29: // Created by Robert Tubb on 21/02/2013. rt300@29: // rt300@29: // rt300@29: rt300@29: #import "ServerComms.h" rt300@29: rt300@29: @implementation ServerComms rt300@29: -(void)test{ rt300@29: NSLog(@"hi"); rt300@29: } rt300@29: -(void)postRequest:(NSString *)msgbody{ rt300@29: NSMutableURLRequest *request = [[NSMutableURLRequest alloc] rt300@29: initWithURL:[NSURL rt300@29: URLWithString:msgbody]]; rt300@29: rt300@29: [request setHTTPMethod:@"POST"]; rt300@29: [request setValue:@"text/xml" rt300@29: forHTTPHeaderField:@"Content-type"]; rt300@29: rt300@29: NSString *xmlString = @"Item 1Item 2"; rt300@29: rt300@29: [request setValue:[NSString stringWithFormat:@"%d", rt300@29: [xmlString length]] rt300@29: forHTTPHeaderField:@"Content-length"]; rt300@29: rt300@29: [request setHTTPBody:[xmlString rt300@29: dataUsingEncoding:NSUTF8StringEncoding]]; rt300@29: rt300@29: [[NSURLConnection alloc] rt300@29: initWithRequest:request rt300@29: delegate:self]; rt300@29: } rt300@29: rt300@29: rt300@29: - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{ rt300@29: NSLog(@"!!!!!!!!!!!!!!!!!!!!connection error"); rt300@29: } rt300@29: rt300@29: - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{ rt300@29: NSLog(@"!!!!!!!!!!!!!!!!!!!!didReceiveResponse"); rt300@29: } rt300@29: rt300@29: - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{ rt300@29: NSLog(@"!!!!!!!!!!!!!!!!!!!!didReceiveData"); rt300@29: } rt300@29: rt300@29: - (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse{ rt300@29: rt300@29: } rt300@29: rt300@29: @end