开发者

Java: Is it possible to send SMS from a Java application

开发者 https://www.devze.com 2022-12-29 22:55 出处:网络
Is it possibleto send SMS from a Java application. I don\'t want to use J开发者_运维知识库2ME in this case. I want to know with respect to J2SE and J2EE only. Is there any API available to achieve thi

Is it possible to send SMS from a Java application. I don't want to use J开发者_运维知识库2ME in this case. I want to know with respect to J2SE and J2EE only. Is there any API available to achieve this? If it is available whether we have to use any service provider or not for this? Can you tell me how to achieve that?


Certainly. We're currently sending SMS messages via Ericsson IPX. We simply POST to a specific URL to send the message (and they post an XML document to our URL when we receive SMSes). This is easy to do in most languages.

There are also quite a few lower-end providers that allow free or low-cost SMSes as long as the volume is low enough.


You could look into my cool sms, they have an API for sending SMS, works with Java.


The best way to achieve this is to use an SMS gateway. An SMS gateway encapsulates the technicalities of interfacing with SMS carrier medium on one hand and on other hand it provides an interface for application level protocols like http, SMTP, ftp etc. to interact with it. For example, you can have a web application talking to the SMS Gateway over HTTP and the gateway on its other side will talk to the SMS centre over some proprietory protocol to send the SMS text received from the application. This way, the application need not know the low level protocols to send the SMSs.

You can lease a line to an SMS center (SMSC) if you need to send large number of bulk SMSs and configure your SMS gateway to use this lease line to send the msgs. But leasing a line is far more expensive. If you need to send small number of messages, then you can use your mobile phone in place of the leased line. Attach your mobile phone to your PC/Server and configure the Gateway to use your phone. You need to refer to your gateway documentation on interfacing your phone with the gateway. This is not very difficult but fairly simple.

There are lot of commercial gateways available in the market which can be used. But using an open source SMS gateway is a good option. You can use an open source gateway called - Kannel. Believe me, it is not very difficult to set it up and start using.


It is possible, but this isn't java-specific. Mobile providers (and resellers) offer APIs for sending SMS. These may include

  • web-services
  • HTTP get/post requests
  • sockets

You can do all of these with Java.


www.openmarket.com has a Java SDK

0

精彩评论

暂无评论...
验证码 换一张
取 消