Search code examples
iossslsoaphttpsafnetworking-2

NSURLErrorDomain Code=-1012 with Reverse Proxy


Try to connect to a SOAP Webservice with a iOS App (NSUrlSession, AFNetworking-2). The Webservice is working fine with http and https (not a self-signed certificate). Now, our IT has activate the Reverse Proxy for the Webservice Port. By using the the same code, now I get this error:

2015-11-06 08:19:59.473 ReverseProxy[1566:822246] Bad SOAP server!. Error: Error Domain=NSURLErrorDomain Code=-1012 "(null)" UserInfo={NSErrorFailingURLKey=https://xxx.xxx.com:8833/xxx/xxx, NSErrorFailingURLStringKey=https://xxx.xxx.com:8833/xxx/xxx}

First idea was, there is something wrong with the Reverse Proxy. But doing the same request with SOAPUI, is working fine.

Any idea why the app is not working with the Reverse Proxy?


Solution

  • Problem solved.

    Don't implement this delegate for NSURLSession..

    -(void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler
    

    .. just implement this delegate for NSURLSessionTask.

    -(void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler
    

    This solved my problem