這是我的XML後XMLDATA通過web服務iphone問題
NSString *Message = [NSString stringWithFormat:
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<query>\n"
"<IdCategory>1088</IdCategory>\n"
"</query>\n"];
NSURL *url = [NSURL URLWithString:@"http://bvd.vndsupport.com/_ws/api/categories/index.asp"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSString *msgLength = [NSString stringWithFormat:@"%d", [Message length]];
[theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody: [Message dataUsingEncoding:NSUTF8StringEncoding]];
NSString *returnString = [[NSString alloc] initWithData:[NSURLConnection sendSynchronousRequest:theRequest returningResponse:nil error:nil] encoding:NSUTF8StringEncoding];
NSLog(@"%@",returnString);
我只是通過這一類ID和得到的結果卻總是returnString
顯示所有類別的詳細信息。我沒有得到確切的結果。這是將xml數據傳遞給webservice的正確方法嗎?
我有一個用戶名和密碼的XML文件什麼。所以,它需要進行身份驗證。我如何驗證這個XML文件,但用戶名和密碼? – 2012-08-13 04:25:10
創建一個字符串格式,按您的XML和傳遞到Web服務的URL – Rams 2012-08-13 04:42:21
如何設置用戶名和密碼?,如何頂部連接的URL,這些用戶名名和密碼? – 2012-08-13 04:58:53