Ios SOAPWebAPI请求返回HTML而不是XML

Ios SOAPWebAPI请求返回HTML而不是XML,ios,asp.net,iphone,web-services,soap,Ios,Asp.net,Iphone,Web Services,Soap,我不熟悉soapapi 我正在使用以下代码访问我的API NSString *stringURL=[NSString stringWithFormat:@"http://tennispro.co.in/services.asmx"]; // Allocate and initialize an NSURLConnection with the given request and delegate. The asynchronous URL load process is started as

我不熟悉soapapi

我正在使用以下代码访问我的API

NSString *stringURL=[NSString stringWithFormat:@"http://tennispro.co.in/services.asmx"];

// Allocate and initialize an NSURLConnection with the given request and delegate. The asynchronous URL load process is started as part of this method.

NSString *soapMessage = [NSString stringWithFormat:@"<?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>"
                         "<ReturnSyncMasterData xmlns=\"http://tempuri.org/\">"
                         "<datetime>%@</datetime>"
                         "</ReturnSyncMasterData>"
                         "</soap:Body>"
                         "</soap:Envelope>",@""];


NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:stringURL]];

[request addValue:@"text/html; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[request addValue:@"2159" forHTTPHeaderField:@"Content-Length"];
[request addValue:@"private, max-age=0" forHTTPHeaderField:@"Cache-Control"];
[request addValue:@"gzip" forHTTPHeaderField:@"Content-Encoding"];
[request addValue:@"http://tempuri.org/services/ReturnSyncMasterData" forHTTPHeaderField:@"SOAPAction"];
[request setHTTPBody:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPMethod:@"POST"];

theConnection = [NSURLConnection connectionWithRequest:request delegate:self];

if (theConnection) {
    receivedData = [[NSMutableData alloc] init];
}
但作为回应,我得到的是HTML而不是XML。我想访问ReturnSyncMasterData soap操作,但无法调用它

将内容类型设置为text/xml

[request addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[request addValue:@"2159" forHTTPHeaderField:@"Content-Length"];
[request addValue:@"private, max-age=0" forHTTPHeaderField:@"Cache-Control"];
[request addValue:@"gzip" forHTTPHeaderField:@"Content-Encoding"];
[request addValue:@"http://tempuri.org/services/ReturnSyncMasterData" forHTTPHeaderField:@"SOAPAction"];
[request setHTTPBody:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPMethod:@"POST"];

theConnection = [NSURLConnection connectionWithRequest:request delegate:self];

if (theConnection) {
    receivedData = [[NSMutableData alloc] init];
}