Java Sending SMS via SOAP

From SMS Wiki
Revision as of 10:42, 5 June 2007 by Old-user20 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The process of sending an SMS using Java is fairly straightforward.

The easiest setup is to use Eclipse with the XFire plugin. XFire is an opensource Java SOAP interface http://xfire.codehaus.org/

Once you have the plugin installed, add the XFire nature to your project by right clicking on the project and selecting "Add XFire Nature"

Then, again, right click on the project and specify "New > Other...". At the bottom of the list should be an option labeled "Code generation from WSDL Document". Select this option and enter the following into the dialog presented:

WSDL: http://api.upsidewireless.com/soap/Authentication.asmx?WSDL Output Directory: <Your source directory> Package: <Leave Blank> (By leaving this field blank, the default package of the service will be used)

Click Finish and it will build the necessary source files. Repeat the process for: http://api.upsidewireless.com/soap/SMS.asmx?WSDL

Now that you have both sets of XFire client code generated (one for authentication and the other for sending SMS), now it is time to make a call. The essence of making the call is the following 3 lines of code (it can be reduce down to a single line of code, but that would make debugging difficult):

SMSClient client = new SMSClient(); SMSSoap soap = client.getSMSSoap(); soap.send_Plain(token, signature, "+15557779999", "Hello", SmsEncoding.SEVEN);