How to send a SMS text from an app to the server?
I don't mean pass a string. Can it be done to have a dedicated phone number for a server, then write an app that would simply send a sms to that number and receive that message on the server. I searched the internet but can't see any answers, thanks in advance.
Check these out bro. These show a list of service providers which do provide the functionality you desire. https://www.raymond.cc/blog/top-10-sites-receive-sms-online-without-phone/
HTTP is the simplest method to send data from one application to another. Java has native method calls to submit HTTP requests. This means that HTTP is a good choice to send SMS text messages to mobile phones. Please have a look at this link
You don't mention which country you are in, or indeed if you want to use this mechanism across multiple carriers, so I will limit my response to GSM networks in the EU and some of Latin America, although this don't assume interoperability across those regions.
Some carriers offer a service commonly called 'big mobile numbers', pseduo-MSISDNs or Mobile Virtual Numbers. These look like normal mobile numbers but are connected to a server, rather than a mobile device. They normally support SMS but not voice services. There are a number of patents from the early to mid 1990s related to emulating a mobile device which is good background reading if you are inetrested in the detail.
The implementation generally consists of device [Intelligent Network Node] in the host mobile network that responds to inbound SMS messages as if it is a mobile terminal. Generally these numbers are allocated in the same way as any other number and are often not distinguishable from other numbers in the host network.
Messages received by said numbers are then sent to the associated application via common protocols such as SMPP, HTTP[S] or even email. Sophisticated implementations are even capable of dealing with absent subscriber status and the like.
It is almost impossible these days, unless you are a very large organisation, to gain direct access to this functionality via a mobile network. That said, there are many SMS Aggregators that offer this functionality. They generally charge a monthly subscription for each number (often because the Carrier charges like this) and optionally for each message received. Some have a policy that you have to send as many messages as you received, minimum outbound message volumes, etc.
Companies like Twilio, SilverStreet and Esendex, among many others, offer services like this, although you are well advised to seek 'premium' connections as the €2/month type services work well in some places and not in others. If you are fortunate enough that your customers are in one of the zones that work then great, otherwise try and seek out Aggregators that offer region specific support, even if this means integrating with more than one supplier and paying a bit more for your numbers.
Also, finally, do not assume you have to use the Carrier to send outbound messages. Often the inbound provider is not necessarily your best choice of outbound provider... assuming outbound is relevant.