2011-06-10 152 views
0

我在IOS中使用ASIHTTPRequest。我有一个wsdl/soap网络服务。 当我打电话给我的网络系列时,我得到了错误400错误的请求。我正在使用此代码:ASIHTTPRequest 400错误请求(肥皂)

NSData *xmlData = // I construct the soap message witk soapui 

NSURL *url = [NSURL URLWithString:@"https:myUrlWSDL"]; 
self.currentRequest = [ASIFormDataRequest requestWithURL:url]; 
[self.currentRequest appendPostData:xmlData]; 
[self.currentRequest setDelegate:self]; 
[self.currentRequest startAsynchronous]; 

[[currentRequest requestHeaders] description]; 
NSLog(@"Headers %@",[currentRequest requestHeaders]); 

NSLog显示给我:headers(null)。

我的第一个问题,为什么头是空的?这是正常的吗?

而在控制台我有400个不好的请求。 在委托时,我做的:

- (void)requestFinished:(ASIHTTPRequest *)request 
{ 
    NSLog(@"headers: %@", [self.currentRequest responseHeaders]); 
} 

,它表明寿我:

"Cache-Control" = "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"; 
    Connection = close; 
    "Content-Encoding" = gzip; 
    "Content-Length" = 285; 
    "Content-Type" = "text/xml; charset=utf-8"; 
    Date = "Fri, 10 Jun 2011 01:25:40 GMT"; 
    Expires = "Thu, 19 Nov 1981 08:52:00 GMT"; 
    Pragma = "no-cache"; 
    Server = Apache; 
    "Set-Cookie" = "symfony=...4; path=/"; 
    Vary = "Accept-Encoding,User-Agent"; 
    "X-Powered-By" = "PHP/5.3.3"; 

我的问题是:为什么400坏请求错误?我的要求有什么问题?或者问题出在我的肥皂上?

感谢您的回答。

回答

0

据我所知,发出一个SOAP/WSDL请求时,你需要设置一些头在你的要求

Content-Type: text/xml 
Content-Length: length of your message in bytes 
SOAPAction: your SOAPAction goes here 

ASIHTTPRequest设置内容长度本身(不知道内容类型) 。你将不得不自己添加SOAPAction头。

+0

它不工作。问题是服务器的mod安全性,我不知道如何构建我的请求来传递此信息。 – samir 2011-06-10 09:16:40