URLConnection "application has gone off-line"

When I use URLConnection I get this error: “application has gone off-line”.

I created a clsCallHTTP class as super URLConnection.
The clsCallHTTP class has:

a property called iTimeOut or ftype Integer
a property called sResult of type String
a method called PostHTTP with this code inside:

Public Sub PostHTTP(sURL as string) Self.sResult = "" Self.sResult = Self.SendSync("POST", sURL, Me.iTimeOut) End Sub

a Event Handlers ContentReceived with this code:

Sub ContentReceived(URL As String, HTTPStatus As Integer, content As String) Handles ContentReceived self.sResult = content End Sub

Then I have a WebDialog called wDoc which has a cHttp property of type clsCallHTTP.
In a button of this WebDialog I call my method in this way:

Dim URL as string = "https://www.domain.com/api/v0.3/SaveDocument" Dim sDATA as string = "apiKey=myapikey&xml=myxmldata" cHttp = New clsCallHTTP cHttp.iTimeOut = 30 cHttp.RequestHeader("Content-Type") = "text/html;charset=UTF-8" cHttp.SetRequestContent(sDATA, "application/x-www-form-urlencoded") cHttp.PostHTTP(URL) Do Until cHttp.sResult <> "" 'whait Loop Dim postResponse As String = "" postResponse = cHttp.sResult

When I use it in local debugging, both Windows and MacOS, it works. When I compile it and publish it on my Linux server it doesn’t work.
The application works for all features, such as: reading and writing to MySQL, opening the Map, etc. But when I call the PostHTTP method of class clsCallHTTP the application go off-line.

Why in Debug work and compiled doesn’t work?
Have to enable something on my Linux server?

Thanks!

Has it ever happened to anyone that the application goes offline?
Does anyone use URLConnection on a WebApp?

Gabriele, have you checked that your linux server has all the library needed by URLConnection?

Don’t use SendSync. When you do this, your app locks up and waits for a response. If it takes long enough, the clients will disconnect and you’ll get the offline message. You should use the Send message and handle the responses asynchronously.

@Greg O’Lone with Send or SendSync the result is the same. I tried it now.

@Antonio Rinaldi what library need Linux? I published the entire Libs folder.

I have another Xojo WebApp that runs on the same server, on another domain, and it works. But this one uses the GET method.

Ok, today I tried to my Linux Server, on the same domain folder, to execute the Send method and check the event to verify the result.
If I use GET method, it works perfectly.
If I use POST method, the application go off-line.

[quote=452983:@Gabriele Marchionni]Ok, today I tried to my Linux Server, on the same domain folder, to execute the Send method and check the event to verify the result.
If I use GET method, it works perfectly.
If I use POST method, the application go off-line.[/quote]
What version of Xojo are you using?

Xojo 2019 release 1.1

Ok, we’ll it sounds like the post is crashing the app for some reason. Try creating a separate console app that just does the post and running that. You should get some output telling you if it crashed or an exception occurred.