Why i'm getting WRONG_VERSION_NUMBER when making a POST request to a HTTPS Server? - ssl

My app does a lot of HTTP requests to a server. After installing a SSL certificate on it, the app broke.
My server is running Ubuntu with Nginx hosting PHP code (using the certificate and working) and "proxy-ing" the app server code written in NodeJS. It was working until I changed to HTTPS.
My POST Request typical usage:
var jsonRequest = //Some JSON.
Map<String, String> headers = {'Content-type': 'application/json'};
var response = await http.post(urls['auth'], body: jsonRequest,headers: headers);
The error I get:
E/flutter (25875): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: HandshakeException: Handshake error in client (OS Error:
E/flutter (25875): WRONG_VERSION_NUMBER(tls_record.cc:242))
E/flutter (25875): #0 IOClient.send (package:http/src/io_client.dart:33:23)
E/flutter (25875): <asynchronous suspension>
E/flutter (25875): #1 BaseClient._sendUnstreamed (package:http/src/base_client.dart:169:38)
E/flutter (25875): <asynchronous suspension>
E/flutter (25875): #2 BaseClient.post (package:http/src/base_client.dart:54:7)
E/flutter (25875): #3 post.<anonymous closure> (package:http/http.dart:70:16)
...

As #Patrick mentioned in the comments, this is the result of TLS mismatch.
General thumb rule: If the server (API) is based on https (TLS) then the client should connect using https. If the server uses http (non-TLS) then the client should use http to connect to it.
In your case, seems like the API you are trying to hit is an http type hence from your flutter app you should use:
Uri.http(baseUrl, endPointUrl)

I think you are using https:// but havent installed SSL certificate. So try to use http:// instead of https://.
This work in my case.
hope also work on your side.

Add this to your android/app/src/main/AndroidManifest.xml
android:usesCleartextTraffic="true"
the result is this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.contact_wsp">
<application
android:label="contact_wsp"
android:usesCleartextTraffic="true"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"

Related

Prestashop 1.5 can't enable SSL

I have strange problem. I have enabled SSL in my provider settings. I am using Let's encrypt certificate. But I cannot enable https in prestashop backoffice. If I check Enable SSL button to Yes and click save, following error shows up:
Fatal error: Uncaught Error: Access to undeclared static property: Validate::$values in /home/www/vozikyprozivot.cz/www/vozikyprozivot.cz/classes/controller/AdminController.php:1026 Stack trace: #0 /home/www/vozikyprozivot.cz/www/vozikyprozivot.cz/classes/controller/AdminController.php(581): AdminControllerCore->processUpdateOptions() #1 /home/www/vozikyprozivot.cz/www/vozikyprozivot.cz/classes/controller/Controller.php(158): AdminControllerCore->postProcess() #2 /home/www/vozikyprozivot.cz/www/vozikyprozivot.cz/classes/Dispatcher.php(348): ControllerCore->run() #3 /home/www/vozikyprozivot.cz/www/vozikyprozivot.cz/admin16/index.php(53): DispatcherCore->dispatch() #4 {main} thrown in /home/www/vozikyprozivot.cz/www/vozikyprozivot.cz/classes/controller/AdminController.php on line 1026
I tried to force enable redirect http to https in .htaccess file, but with no luck.
Can you help please?
Thanks a lot.
Eduard
Web Hosting company should mix something to your php
Like this at settings.inc.php
if( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) ) {
$_SERVER['HTTPS'] = 'on';
$_SERVER['SERVER_PORT'] = 443;
}

Https with TLS 1.2 in Xamarin

I'm using HttpClient in Xamarin to request to https with TLS 1.2 and I got the error as below;
System.AggregateException: One or more errors occurred ---> System.Net.WebException: Error writing headers ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.
at Mono.Security.Protocol.Tls.RecordProtocol.ProcessAlert (AlertLevel alertLevel, AlertDescription alertDesc) [0x00013] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.9.1.3/src/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:574
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x000d0] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.9.1.3/src/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:376
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslClientStream.EndNegotiateHandshake (IAsyncResult result) [0x00035] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.9.1.3/src/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs:425
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x0000c] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.9.1.3/src/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs:99
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x0005e] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.9.1.3/src/mono/mcs/class/System/System.Net/HttpWebRequest.cs:969
at System.Threading.Tasks.TaskFactory`1[System.Net.WebResponse].InnerInvoke (System.Threading.Tasks.TaskCompletionSource`1 tcs, System.Func`2 endMethod, IAsyncResult l) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Threading.Tasks/TaskFactory_T.cs:473
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:62
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[System.Net.WebResponse].GetResult () [0x00034] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/ConfiguredTaskAwaitable_T.cs:62
at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x002d0] in /Developer/MonoTouch/Source/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs:338
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:62
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[System.Net.Http.HttpResponseMessage].GetResult () [0x00034] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/ConfiguredTaskAwaitable_T.cs:62
at System.Net.Http.HttpClient+<SendAsyncWorker>c__async0.MoveNext () [0x000a9] in /Developer/MonoTouch/Source/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:273
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.Wait (Int32 millisecondsTimeout, CancellationToken cancellationToken) [0x00049] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Threading.Tasks/Task.cs:709
at System.Threading.Tasks.Task.Wait () [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Threading.Tasks/Task.cs:679
at System.Threading.Tasks.Task`1[System.Net.Http.HttpResponseMessage].get_Result () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Threading.Tasks/Task_T.cs:48
at Cucumber.ViewModels.LoginViewModel+<ExecuteLoginCommand>c__async0.MoveNext () [0x00144] in /Users/bachpx1/FSBProjects/FsoftInternalNews/cucumber/xamarin_form/Cucumber/Cucumber.Shared/ViewModels/LoginViewModel.cs:94
--> (Inner exception 0) System.Net.WebException: Error writing headers ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.
at Mono.Security.Protocol.Tls.RecordProtocol.ProcessAlert (AlertLevel alertLevel, AlertDescription alertDesc) [0x00013] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.9.1.3/src/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:574
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x000d0] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.9.1.3/src/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:376
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslClientStream.EndNegotiateHandshake (IAsyncResult result) [0x00035] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.9.1.3/src/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs:425
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x0000c] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.9.1.3/src/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs:99
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x0005e] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.9.1.3/src/mono/mcs/class/System/System.Net/HttpWebRequest.cs:969
at System.Threading.Tasks.TaskFactory`1[System.Net.WebResponse].InnerInvoke (System.Threading.Tasks.TaskCompletionSource`1 tcs, System.Func`2 endMethod, IAsyncResult l) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Threading.Tasks/TaskFactory_T.cs:473
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:62
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[System.Net.WebResponse].GetResult () [0x00034] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/ConfiguredTaskAwaitable_T.cs:62
at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x002d0] in /Developer/MonoTouch/Source/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs:338
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:62
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[System.Net.Http.HttpResponseMessage].GetResult () [0x00034] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/ConfiguredTaskAwaitable_T.cs:62
at System.Net.Http.HttpClient+<SendAsyncWorker>c__async0.MoveNext () [0x000a9] in /Developer/MonoTouch/Source/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:273
Do anyone know how to fix this issue. I have heard is Xamarin are errors with TLS in Mono 2.0.
Many thanks
TLS is not yet fully implemented in Mono. That means your HTTPS requests may fail where they would not when running your .NET app on Windows.
Xamarin Deployment
Since you are using Xamarin, you can use ModernHttpClient which is a wrapper around the native iOS / Android networking libraries.
Android, Mac and iOS users can get the latest TLS for HTTP workloads
using ModernHttpClient. Mac/iOS users can use the built-in
CFNetworkHandler as well.
Linux/Mac Deployment
If you are deploying Mono on Linux/Mac (without Xamarin), you'll need to find a workaround for the lack of TLS support.
There are 2 possible workarounds that come to mind:
Use a Custom TLS Implementation
Try using juhovh/AaltoTLS, which is an implementation of the SSL/TLS network protocol written completely using C# and standard cryptographic libraries of .NET where relevant. It will take care of the TLS decryption/encryption and won't use the built-in lacking Mono implementation.
Implement a TLS Proxy
Build a TLS Proxy that will do the TLS heavy-lifting for you -- you'll configure it as an HTTP proxy for your HTTP requests in Mono, it will receive them, and query the target server via HTTPS, handling the encryption and decryption for the Mono app.
Workflow:
Mono App -> HttpClient sends HTTP request via TLS Proxy -> TLS Proxy converts HTTP request to HTTPS and sends it to target server -> TLS Proxy receives response -> TLS Proxy sends back response to HttpClient in HTTP format
Example code in Node.js for the TLS Proxy workaround using nodejitsu/node-http-proxy:
// Modules
var http = require('http');
var httpProxy = require('http-proxy');
// Proxy server options
var options = {secure: true}; // Validate remote SSL certificates
// Create a proxy server with custom application logic
var proxy = httpProxy.createProxyServer(options);
// Handle errors gracefully
proxy.on('error', function(e) {
// Log to console
console.log(e);
});
// Create server and define custom logic
var server = http.createServer(function(req, res) {
// URL provided?
if (req.url) {
// Convert to HTTPS
req.url = req.url.replace('http://', 'https://');
}
// Get remote host from headers (and force HTTPS)
var target = 'https://' + req.headers.host;
// Proxy the request (target is the server to pass the request on to)
proxy.web(req, res, { target: target });
});
// Proxy port
var port = 8080;
// Start listening for requests from clients
server.listen(port);
// Log the port number
console.log('proxy.port: ' + port);
Found this error at Release build, yet not in Debug build.
For Xamarin + VS, TLS 1.2 can be set in Android Project Properties (right click on your Android Project > Properties on bottom) > Android Options > scroll to bottom, click Advance > bottom, SSL/TLS Implementations. There you found Native TLS 1.2+.
I'm not aware of a generic cross-platform Xamarin solution for this.
Xamarin has an option to support TLS 1.2 for iOS9 with App Transport Security ( https://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/ats/ ) :
Any connection made with NSUrlConnection, CFUrl or NSUrlSession will
use ATS by default in apps built for iOS 9 and OS X 10.11 (El
Capitan).
ATS will enforce the following requirements for all internet
connections: All connection ciphers must be using forward secrecy. The
Transport Layer Security (TLS) protocol must be version 1.2 or
greater. At least a SHA256 fingerprint with either a 2048 bit or
greater RSA key, or a 256 bit or greater Elliptic-Curve (ECC) key must
be used for all certificates.
There is a community push to fill this gap since April 2014 at https://xamarin.uservoice.com/forums/144858-xamarin-platform-suggestions/suggestions/5758129-implement-tls-1-2 .
Currently TLS 1.2 is supported by Mono release 4.8.0

8.51 tools PSAPPSRV crash

Tried to install fresh instance of PT on VM running Linux with following versions:
OS: Linux CentOS 6.5 64bit
Database: Oracle 11.2.0.1 64bit
App Serv: Tuxedo 11gR1 11.1.1.3 64bit RP015
Web Serv: WebLogic 10.3.6
JDK: Jrockit for linux jdk 1.6.0_45 R28.2.7-4.1.0 64bit
PT: 8.51.25
I could:
- start DB, able to connect w SQLPLUS, App Designer, Data Mover
- start App Serv (listening on ports 7000, 9000)
- start Web Serv
- Access to Web Page (Web Serv is running fine)
Once I load PIA login page, I got TPESVCERR error (default setting error).
Same error if i try to login via PIA.
Web Serv Log (same error can be seen repeatedly)
SEVERE psft.pt8.net.NetReqRepSvc sendRequest TPESVCERR - server error while handling request
SEVERE psft.pt8.net.NetReqRepSvc sendRequest An error occurred on the application server within Jolt while running the service. Cancel the current operation and retry. If the problem persists contact your system administrator. Error Code:10
SEVERE psft.pt8.net.NetReqRepSvc sendRequest Application Server last connected //192.168.236.129_9000
SEVERE psft.pt8.auth.WebProfile loadProfile ERROR: WebProfile loading internal default settings because of an Exception while communicating with "192.168.236.129:9000"
SEVERE psft.pt8.auth.WebProfile loadProfile TPESVCERR - server error while handling request
SEVERE psft.pt8.net.NetReqRepSvc sendRequest TPESVCERR - server error while handling request
SEVERE psft.pt8.net.NetReqRepSvc sendRequest An error occurred on the application server within Jolt while running the service. Cancel the current operation and retry. If the problem persists contact your system administrator. Error Code:10
SEVERE psft.pt8.net.NetReqRepSvc sendRequest Application Server last connected //192.168.236.129_9000
SEVERE psft.pt8.util.PIAPerfUtil initializePSPerf PerfMon: Unable to retrieve performance monitor MonitorURL, Reason:Error connecting to AppServer, Ppm JoltSession to 192.168.236.129:9000 not created, reason: bea.jolt.ServiceException: TPESVCERR - server error while handling request
App Serv Log (same error can be seen repeatedly)
PSAPPSRV.3767 (1) [06/25/14 09:29:08 GetCertificate](0) Process aborted.
PSPAL: Abort: Unexpected signal received
PSPAL: Abort: Location: /vob/peopletools/src/pspal/exception_sigaction.cpp:494: RecoverableSignalHandler
PSPAL: Abort: Generating process state report to /db/pt851cfg/appserv/psdb1/LOGS/PSAPPSRV.3983/process_state.txt
PSAPPSRV.4171 (0) [06/25/14 09:29:15](0) PeopleTools Release 8.51.25 (Linux) starting. Tuxedo server is APPSRV(99)/1
PSAPPSRV.4171 (0) [06/25/14 09:29:15](0) Cache Directory being used: /db/pt851cfg/appserv/psdb1/CACHE/PSAPPSRV_1/
PSAPPSRV.4171 (0) [06/25/14 09:29:15](2) App server host time skew is DB+00:00:00 (ORACLE PSDB)
PSAPPSRV.4171 (0) [06/25/14 09:29:15](2) (PreloadMemoryCache) No project name set in the configuration file Cache Settings parameter, PreloadMemoryCache. Nothing to preload into memory cache.
PSAPPSRV.4171 (0) [06/25/14 09:29:15](2) Use FTP Library has value : Y
PSAPPSRV.4171 (0) [06/25/14 09:29:15](0) Server started
PSAPPSRV.3983 (1) [06/25/14 09:29:17 GetCertificate](0) Process aborted.
Tuxedo Log (same error can be seen repeatedly)
092925.PSDB!PSAPPSRV.4357.735041312.0: 06-25-2014: Tuxedo Version 11.1.1.3.0, 64-bit
092925.PSDB!PSAPPSRV.4357.735041312.0: LIBTUX_CAT:262: INFO: Standard main starting
092925.PSDB!PSAPPSRV.4357.735041312.0: LIBTUX_CAT:476: WARN: Server 99/2: client process 3487: lost message
092925.PSDB!PSAPPSRV.4357.735041312.0: LIBTUX_CAT:477: WARN: SERVICE=GetCertificate MSG_ID=0 REASON=server died
I don't think there is any problem with connection between Web Serv and App Serv.
(When i shutdown App Serv, Web Serv will complain of App Serv not available)
From the logs, it appears that PSAPPSRV crashed while working on GetCertificate request.
The debug info says "unable to determine location of exception" which is troubling.
Extract from stack trace:
#0 0x0000003b80ae15e3 in select () from /lib64/libc.so.6
#1 0x00007f3ccafc58f7 in PSPAL::DumpProcessState::CallDebugger(int, char const*, PSPAL::ExceptionContext const*, bool) () from /db/pt851/bin/libpspal64.so
#2 0x00007f3ccafc5bd4 in PSPAL::DumpProcessState::GenerateAbortDiagnostics(char const*, PSPAL::ExceptionContext*) () from /db/pt851/bin/libpspal64.so
#3 0x00007f3ccafba1db in PSPAL::Abort(char const*, char const*, int, char const*, PSPAL::ExceptionContext*) () from /db/pt851/bin/libpspal64.so
#4 0x00007f3ccafbfad1 in PSPAL::SigactionSignalHandler::RecoverableSignalHandler(int, siginfo*, void*) () from /db/pt851/bin/libpspal64.so
#5 0x00007f3ccafc03a5 in PSPAL::SigactionSignalHandler::SignalHandler(int, siginfo*, void*) () from /db/pt851/bin/libpspal64.so
#6 <signal handler called>
#7 0x00007f3cca099f0e in CReadSerialObj::Init(void*) () from /db/pt851/bin/libpscmnutils.so
#8 0x00007f3cca09a275 in CReadSerialObj::CReadSerialObj(EOBJECT_TYPE, void*) () from /db/pt851/bin/libpscmnutils.so
#9 0x00007f3cca09a449 in CReadFrame::CReadFrame(EOBJECT_TYPE, void*) () from /db/pt851/bin/libpscmnutils.so
#10 0x00007f3cc8b33b59 in CNetRecvMsg::CNetRecvMsg(void*) () from /db/pt851/bin/libpsnetapi.so
#11 0x00007f3cc8b3e557 in CNetReqRepSvc::CNetReqRepSvc(CNetServer*, tpsvcinfo*, wchar_t const*) () from /db/pt851/bin/libpsnetapi.so
#12 0x00007f3cc082ce5c in CCertificateService::CCertificateService(CNetServer*, IPSSignonPeopleCode*, tpsvcinfo*) () from /db/pt851/bin/libpssecurity.so
#13 0x00007f3cc082f2a7 in CertificateServiceFactory::Create(CNetServer*, IPSSignonPeopleCode*, tpsvcinfo*) const () from /db/pt851/bin/libpssecurity.so
#14 0x0000000000419235 in CAppServer::GetCertificate(tpsvcinfo*) ()
#15 0x000000000041549d in GetCertificate ()
#16 0x00007f3cccdaca4b in _tmsvcdsp () from /db/tuxedo/tuxedo11gR1/lib/libtux.so
#17 0x00007f3cccdd4146 in _tmrunserver () from /db/tuxedo/tuxedo11gR1/lib/libtux.so
#18 0x00007f3cccdaa42c in _tmstartserver () from /db/tuxedo/tuxedo11gR1/lib/libtux.so
#19 0x000000000040a747 in main ()
Have tried many different configuration settings, no joy. Could it be library compatibility issue?
Any help would be appreciated.
8:51 PT version is only certified for Oracle Tuxedo version 10.3.0.0.0
And you are using version 11g, this may be the problem of crash AppServer.
hope this helps :)

Webservice is not working anymore after changed firewall hardware (Dell sonicwall)

We have built for a customer websiteB in c# asp.net. There is also another website in php which is builded by another company. This is websiteA. The enduser is try to log in on websiteA. Underwater there is a request to a webservice on websiteB with username/password as parameters. WebsiteB try to get authenticate the credentials and return a message. WebsiteA is running on some server of another company. WebsiteB is running on our server in the datacenter. This scenario was always working!
No we have changed the firewall hardware in our datacenter. We have now Dell SonicWall. In the beginning the certificates were not working of our webservice. We have fix this. When you run our webservice in the browser the certifcate is OK (there is no red background in the url).
This is the url of my webservice:
https://service.myCompany.com/PortalService.svc
I ask the other company to give me some logging or an exception from there side. They do not get an exception. They got an empty array. They have printed some logging for me after a request:
We have also enabled the logging on the webservice. This is the logging after trying to login on websiteA.
Request to webservice:
<MessageLogTraceRecord>
<HttpRequest xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace">
<Method>POST</Method>
<QueryString></QueryString>
<WebHeaders>
<Connection>Keep-Alive</Connection>
<Content-Length>574</Content-Length>
<Content-Type>text/xml;charset=UTF-8</Content-Type>
<Accept>*/*</Accept>
<Authorization>Basic bWlqbnNlaF9uZXRieXRlczojbjN0Ynl0MzU=</Authorization>
<Host>service.MyCompany.com</Host>
<User-Agent>Jakarta Commons-HttpClient/3.1</User-Agent>
<SOAPAction>"http://schemas.MyCompany.com/SecurityService/SecurityService/LoginUsernamePassword"</SOAPAction>
</WebHeaders>
</HttpRequest>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:test="http://schemas.MyCompany.com/SecurityService">
<soapenv:Header>
<To soapenv:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">https://mycompanyapp01.dmz.mycompany.local/SecurityService.svc</To>
<Action soapenv:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://schemas.MyCompany.com/SecurityService/SecurityService/LoginUsernamePassword</Action>
</soapenv:Header>
<soapenv:Body>
<test:LoginUsernamePassword>
<test:Username><![CDATA[testuser#mycompany.com]]></test:Username>
<test:Password><![CDATA[#test!]]></test:Password>
<test:ReturnToken>true</test:ReturnToken>
<test:ReturnProfile>true</test:ReturnProfile>
<test:ReturnRoles>true</test:ReturnRoles>
</test:LoginUsernamePassword>
</soapenv:Body>
</soapenv:Envelope>
</MessageLogTraceRecord>
Response from webservice:
<MessageLogTraceRecord>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://schemas.MyCompany.com/SecurityService/SecurityService/LoginUsernamePasswordResponse</Action>
</s:Header>
<s:Body>
<LoginUsernamePasswordResponse xmlns="http://schemas.MyCompany.com/SecurityService">
<LoginUsernamePasswordResult xmlns:d4p1="http://schemas.MyCompany.com/datacontracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<d4p1:Token>PJ%2bNtW0Kpy%2frd945r3Q0ziQpoax%2bNIiPNXC8obx%2fl73D2MPTvwFA9TqDtHNzXPq7</d4p1:Token>
<d4p1:UserProfile>
<d4p1:DisplayNameFormal>Test</d4p1:DisplayNameFormal>
<d4p1:DisplayNameInformal>Test</d4p1:DisplayNameInformal>
<d4p1:Email>test#mycompany.com</d4p1:Email>
<d4p1:IsErkendAdviseur>false</d4p1:IsErkendAdviseur>
<d4p1:UserID>testuser#mycompany.com</d4p1:UserID>
</d4p1:UserProfile>
<d4p1:UserRoles xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d5p1:string>Test Medewerker</d5p1:string>
</d4p1:UserRoles>
</LoginUsernamePasswordResult>
</LoginUsernamePasswordResponse>
</s:Body>
</s:Envelope>
</MessageLogTraceRecord>
I have also started the wcf client tool (wcfTestClient.exe). I add the webservice url (https://service.myCompany.com/PortalService.svc). I got this exception:
Error: Cannot obtain Metadata from https://service.MyCompany.com/SecurityService.svc?wsdl
If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange
Error URI: https://service.MyCompany.com/SecurityService.svc?wsdl Metadata contains a reference that cannot be resolved: 'https://service.MyCompany.com/SecurityService.svc?wsdl'.
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Basic realm="service.MyCompany.com"'.
The remote server returned an error: (401) Unauthorized.HTTP GET Error URI: https://service.MyCompany.com/SecurityService.svc?wsdl
The document was understood, but it could not be processed. - The WSDL document contains links that could not be resolved. - There was an error downloading 'https://myCompanyapp01.dmz.myCompany.local/SecurityService.svc?wsdl=wsdl0'. - The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. - The remote certificate is invalid according to the validation procedure.
Why do I see the intern url in the exception while I testing the public url:
intern url: https://myCompanyapp01.dmz.myCompany.local/SecurityService.svc?wsdl
public url: https://service.MyCompany.com/SecurityService.svc?wsdl
The public url has a certificate. The intern url not. When you try the intern url you got a red background in the browser.
I think this whole problem is our firewall. I think there is some restricted option on SOAP outbound messages. Because websiteA which is doing the request dont get an exception. They get also an answer, but it is empty. So it looks like the firewall has make it empty.
What do you think of this problem?
Your WSDL is referencing/including files on the internal app server. Try using a flattened wsdl.

Objective C - HTTP/0.9 response from GET using ASIHTTPRequest

I've started using ASIHTTPRequest in my iOS project to execute REST server method calls and so far have been very successful with it. I just have one strange intermittent problem. Very occasionally I get the following response from using [ASIHTTPRequest startAsynchronous] :
HTTP/0.9 200 OK
When this occurs my server method doesn't get called. Normally every method call returns with a response starting 'HTTP/1.1'. I'm using HTTPS with a GeoTrust/RapidSSL certificate to secure the connection. Interestingly I've found that I get the same 'HTTP/0.9 200 OK' response if I try to connect to the SSL port (443) but specifying 'http' as the protocol.
Just to add more info - the problem mostly occurs after the app has been left idle for a period of time. E.g. request completes successfully, then leave app idle for a while, then on the next request the problem occurs then app continues to work fine.
Can anybody shed some light on what might be occurring?
Many thanks,
Jonathan
UPDATE : I've pasted below some debug information output by ASIHTTPRequest when the problem occurred :
2012-07-12 09:35:49.376 mytestapp[3038:18f07] [CONNECTION] Closing connection #13 because it has expired
2012-07-12 09:35:49.377 mytestapp[3038:18f07] [CONNECTION] Closing connection #14 because it has expired
2012-07-12 09:35:49.378 mytestapp[3038:18f07] [CONNECTION] Closing connection #15 because it has expired
2012-07-12 09:35:49.380 mytestapp[3038:18f07] [CONNECTION] Request #39 will use connection #16
2012-07-12 09:35:49.381 mytestapp[3038:18f07] [CONNECTION] Request #40 will use connection #17
2012-07-12 09:35:49.382 mytestapp[3038:18f07] [CONNECTION] Request #41 will use connection #18
2012-07-12 09:35:49.529 mytestapp[3038:18f07] [STATUS] Request <ASIHTTPRequest: 0x88a1e00> finished downloading data (0 bytes)
2012-07-12 09:35:49.529 mytestapp[3038:18f07] [STATUS] Request <ASIHTTPRequest: 0x88a1e00> received response headers
2012-07-12 09:35:49.530 mytestapp[3038:18f07] [AUTH] Request <ASIHTTPRequest: 0x88a1e00> has passed Basic authentication
2012-07-12 09:35:49.530 mytestapp[3038:18f07] [CONNECTION] Got no keep-alive header, will keep this connection open for 60.000000 seconds
2012-07-12 09:35:49.530 mytestapp[3038:18f07] [CONNECTION] Request #41 finished using connection #18
2012-07-12 09:35:49.531 mytestapp[3038:18f07] [STATUS] Request finished: <ASIHTTPRequest: 0x88a1e00>
2012-07-12 09:35:49.531 mytestapp[3038:15803] responseHeaders={
}
2012-07-12 09:35:49.531 mytestapp[3038:18f07] [STATUS] Request cancelled: <ASIHTTPRequest: 0x88a1e00>
2012-07-12 09:35:49.532 mytestapp[3038:18f07] [STATUS] Request cancelled: <ASIHTTPRequest: 0x88a0200>
2012-07-12 09:35:49.532 mytestapp[3038:18f07] [STATUS] Request <ASIHTTPRequest: 0x88a0200>: Cancelled
2012-07-12 09:35:49.532 mytestapp[3038:18f07] [CONNECTION] Request #39 failed and will invalidate connection #16
2012-07-12 09:35:49.533 mytestapp[3038:18f07] [STATUS] Request cancelled: <ASIHTTPRequest: 0x88a0a00>
2012-07-12 09:35:49.533 mytestapp[3038:18f07] [STATUS] Request <ASIHTTPRequest: 0x88a0a00>: Cancelled
2012-07-12 09:35:49.533 mytestapp[3038:18f07] [CONNECTION] Request #40 failed and will invalidate connection #17
Unsure about IOS specifics in this case but HTTP 0.9 is completely abandoned. There is clear reason for this - it does not support "Host:" header. This means single IP cannot have virtual hosts at all. Such things became obsolete at end of 90-s.
Such response should never happen in real life. If it still happens, some client made request like "GET / HTTP/0.9". But these clients have disappeared ~15 years ago.
SSL is something HTTP is not much aware of. So I believe this is not related. SSL tunnel is set up and after that plain HTTP is ran.
As conclusion I would say you or someone possibly triggered obsolete method. And IOS maybe just have no idea what to do with it. Maybe IOS method is limited methods with host name included and therefore it does not trigger. Anyway you should not worry about it if client is really speaking 0.9 because it anyway does not get proper answers from most of sites. If client speaking 1.1 and you answer 0.9, then possibly request is misunderstood somehow and fallback mechanism to lowest possible HTTP version occurs. Maybe you forgot to setup host name for request or made syntax error in it?
There are some mentions about this problem on the web, and basically it is related to persistent connections, and when something wrong with a Content-length header and a content itself that returned by some buggy servers. It could screw up the browsers and iOS framework, and they don't actually notice the headers.
Here is the one of the possible explanations.
Try to disable persistent connections, it should help. This advice came from developers of ASIHTTPRequest (quite similar situation).
[httpRequest setShouldAttemptPersistentConnection:NO];
HTTP/0.9 200 OK is a non-existant message header. HTTP/0.9 is defined as the request: GET <Request-URI> HTTP/0.9 <CRLF>, the response to which is [Entity-Body], without any status lines nor header. (<urn:ietf:rfc:1945>)
There's an error in your software somewhere. I guess the request either failed, or it's not yet received.