29,027
社区成员
发帖
与我相关
我的任务
分享
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
httpPost = new HttpPost(
"http://localhost:8080/world/mini/api/httpservice/kiwi/zoo/openApiService/authorize.xhtml");
nvps.clear();
nvps.add(new BasicNameValuePair("response_type", "code"));
nvps.add(new BasicNameValuePair("client_id", appId));
nvps.add(new BasicNameValuePair("type", "implicit"));
httpPost.setEntity(new UrlEncodedFormEntity(nvps));
response = httpclient.execute(httpPost);
code = EntityUtils.toString(response.getEntity());
NSDictionary *BasicNameValuePair=@{@"code":@"response_type",
@"10002":@"client_id",
@"implicit":@"type"
};
NSLog(@"BasicNameValuePair:%@",BasicNameValuePair);
NSData *commitBody=[NSJSONSerialization dataWithJSONObject:BasicNameValuePair options:NSJSONWritingPrettyPrinted error:nil];
//创建请求
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
NSString *urlString = [NSString stringWithFormat:@"http://192.168.1.101:8080/world/mini/api/httpservice/kiwi/zoo/openApiService/authorize.xhtml"];
NSURL *submitURL = [NSURL URLWithString:urlString];
[request setURL:submitURL];
[request setHTTPMethod:@"POST"];
[request setTimeoutInterval:10];
NSMutableData *commit = [[NSMutableData alloc] init];
[commit appendData:commitBody];
[request setHTTPBody:commit];