0
I am new to iPhone application development and also this stackoverflow,if I made any mistakes sorry. I have some of the questions
1)我是否需要在我的應用程序中安裝任何其他外部框架。我正在使用SDK模擬器4.2如何從我的iPhone應用程序訪問SOAP Web服務
2)我已經通過了一些在這裏發佈的材料,我發現了一些代碼,並且做了一些修改以適合我的應用程序當我請求URL時,它返回NULL 。
3)我的任務是發送一個三個參數到數據庫。
NSString *post =[NSString stringWithFormat:@"?FirstName=%@?Surname=%@?IDNumber=%@?DOB=%@",namestring,surnamestring,cidstring,dobstring];
NSData *postData = [post dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
NSLog(@"Post Length:",[postData length]);
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:@"http://www.esoft.co.za/MDS/Service1.asmx?op=InsertSuppliers"]];
[request setHTTPMethod:@"GET"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
NSURLResponse *response;
NSError *err;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
NSLog(@"response data is: %@",[responseData length]);
NSString *data = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(@"Data: %@",data);
在此先感謝傢伙...請給我提供任何示例代碼或材料..
我更新了我的代碼與所有的POST請求 – user603644 2011-06-03 00:38:44