My Request
NSString *soapMessage =[NSString stringWithFormat:@"MY_SOAP_MESSAGE"];
NSURL *url = [NSURL URLWithString:@"MY_URL"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSString *msgLength = [NSString stringWithFormat:@"%d",(int)[soapMessage length]];
[theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue: @"MY_SOAP_ACTION" forHTTPHeaderField:@"soapaction"];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:theRequest];
operation.responseSerializer = [AFXMLParserResponseSerializer serializer];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject)
it Always returning unacceptable content type can any one help please ?
I use AFHTTPRequestOperationLogger and it give me this response
POST 'MY_URL': {
"Content-Length" = 250;
"Content-Type" = "text/xml; charset=utf-8";
soapaction = "MY_SOAP_ACTION";
}
Response:
2015-08-28 08:40:58.101 Mofa[2713:198850] 200 'MY_URL' [1.0564 s]: {
"Cache-Control" = "no-cache";
Connection = close;
"Content-Length" = 188;
"Content-Type" = "text/html; charset=utf-8";
Pragma = "no-cache";
} Request RejectedThe requested URL was rejected. Please consult with your administrator.
Your support ID is: 9052083282217935970
The big problem that the Web-Service is working Fine on a SOAP client
I fix the Error by Luck. I remove the XML tag from Soap Message and it works
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
Does anyone knows why this Happened ?