ios - AFNetworking Post request not working -
i facing problem in making post request .net webservice method. have made lot of post request don't seem problem facing here request made of rest client gives me 400 error using afnetworking make post request please find code below if wrong
nsurl *url=[nsurl urlwithstring:@"http://webservice.svc"]; nsmutabledictionary *params=[nsmutabledictionary dictionary]; [params setvalue:@"cabbage123" forkey:@""]; afhttpclient *httpclient = [[afhttpclient alloc] initwithbaseurl:url]; [httpclient setparameterencoding:afjsonparameterencoding]; [httpclient setdefaultheader:@"accept" value:@"application/json"]; [httpclient registerhttpoperationclass:[afjsonrequestoperation class]]; [httpclient postpath:[nsstring stringwithformat:@"users/%@",userid] parameters:params success:^(afhttprequestoperation *operation, id responseobject) { // print response body in text nslog(@"response: %@",responseobject); } failure:^(afhttprequestoperation *operation, nserror *error) { }];
and html response error
afnetworkingoperationfailingurlrequesterrorkey=<nsmutableurlrequest http://webservice.svc/users/userid>, nserrorfailingurlkey=http://webservice.svc/users/userid, nslocalizeddescription=expected status code in (200-299), got 400, afnetworkingoperationfailingurlresponseerrorkey=<nshttpurlresponse: 0x7ba6df0>}
i think there problem afnetworking wcf web-services. connect , use web-service using standard nsurlconnection class. though facing same problem put request now.
Comments
Post a Comment