tags:

views:

8

answers:

0

Is there a way POST or send request to WSDL with endpoint wsDualHttpBinding? It seems that the POST Method like

 NSURL *url = [NSURL URLWithString:"http://localhost/Project/Login"];
 NSString *post = [NSString stringWithFormat:@"%@", "'{\"UserName\":\"user\", "Password\":\"pass\"}'", nil];
 NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding];
 NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];

 NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
 [request setURL:url];
 [request setHTTPMethod:@"POST"];
 [request setValue:postLength forHTTPHeaderField:@"Content-Length"];
 [request setValue:@"application/json; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
 [request setValue:@"json" forHTTPHeaderField:@"dataType"];
 [request setHTTPBody:postData];

 NSError *error;
 NSURLResponse *response;
 NSData *urlData= [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
 NSString *responseString=[[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding];

is not working.. but when if the endpoint is basicHttpbinding the codes works.

Please help..thanks