Android Question Is possible execute Post request with HttpJob PostString over https server?

TIMX

Member
Licensed User
I test the next situations:
reqManager.Initialize(Me,"https://www.example.com") and it work fine, I can make a success get Request
when I Post the next request j.PostString("https://www.example.com","token="&token) I get the next Message :ResponseError. Reason: java.net.SocketTimeoutException: failed to connect to www.example.com (port 51044) after 30000ms, Response:
I'm no sure how HttpJob manage the request. Possible it sends http://www.example.com or https://www.example.com, because if it's the first the server never will be respond

Both are in the same server but different service.
 
Upvote 0

nwhitfield

Active Member
Licensed User
Longtime User
If you pass an https URL, then PostString will just handle it all by magic. If you're getting a timeout, then you most likely have a network problem. Do you have any other tools you can use on the same network to check the connection to the URL you're trying to reach. For example, if you have OpenSSL installed (on Linux, Mac for instance). you could use the command

B4X:
openssl s_client -connect example.com:443

to check that you can make a connection from your network to that address, on the default port used for SSL. Then entering

B4X:
GET / HTTP/1.0

will retrieve the server's home page.

Can you browse to the SSL port on that server? (Not much good if it only accepts POST, but there should at least be some sort of page).
 
Upvote 0

TIMX

Member
Licensed User
Why are you using DBRequestManager to test http requests? DBRequestManager can only be used to connect to jRDC2 servers.
I'm integrating in a server two services "jRDC2 and PushServer", both are running on differents ports, the last service listen devices request for authorization token for Push communication and the other manage the database conecctions.

This server work fine over basic server, but over secure server (with SSL proxy) the Push service don't work from internet or intranet, attach my network diagram
 

Attachments

  • Diagrama1.jpeg
    Diagrama1.jpeg
    45.3 KB · Views: 344
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
To answer the original question (from the title):

Yes. HttpJob.Post works with https urls. No need to do anything special if the certificate is valid. If not then you can initialize OkHttpClient with InitializeAcceptAll.

For further discussion about how to configure your B4J servers to run over SSL, please start a new thread in B4J forum.
 
Upvote 0
Top