次のコードを使用して、http://www.highoncoding.com/Customers.asmx Web サービスを呼び出しています。
更新 1:
今、私は次のコードを持っています:
-(NSMutableArray *) getAll
{
NSURL *baseURL = [NSURL URLWithString:@"http://highoncoding.com/Customers.asmx?op=GetAll"];
NSString *soapBody = @"<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body> <GetAll xmlns=\"http://tempuri.org/\" /></soap:Body></soap:Envelope>";
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:baseURL];
[request setHTTPBody:[soapBody dataUsingEncoding:NSUTF8StringEncoding]];
[request addValue:@"http://tempuri.org/GetAll" forHTTPHeaderField:@"SOAPAction"];
[request addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation start];
ただし、XML を返す代わりに、HTML/CSS を返します。
更新 2:
httpMethod 行がありませんでした:
[request setHTTPMethod:@"POST"];