当我尝试调用在 WCF 中创建的 Web 服务时遇到问题,该服务由 Mac os x 应用程序调用。
这是代码
soapMessage = @"{name:\"Sergio\"}";
NSURL *url = [NSURL URLWithString:@"http://localhost/GSBonoServicios/GSBonoService.svc/HelloWorld"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]];
[theRequest setHTTPMethod: @"POST"];
[theRequest setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[theRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
NSData *requestData = [NSData dataWithBytes:[soapMessage UTF8String] length:[soapMessage length]];
[theRequest setHTTPBody:requestData];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
连接成功但没有响应,我尝试实施一些教程,我正在查看 Stackoverflow,我找到了很多答案,但没有任何效果,我希望你能帮助我。
附言。我不会说很多英语,但我希望我能解释一下,谢谢