How to Send and Read SMS Using XML-RPC


REVISION HISTORY

EDITION ISSUED DATE REMARK
1st  1st of August 2012  Draft "XML-RPC Server version 3.12" and "XML-RPC Client in PHP version"

 

COPYRIGHT

Copyright © 2012 MOBITEK System Sdn. Bhd. All rights reserved.

No part of this document may be reproduced, distributed, stored in a retrieval system or translated into any language, in any form or by any means, electronic, mechanical, magnetic, optical, photocopying, manual or otherwise, without the prior written permission of MOBITEK System Sdn. Bhd (hereafter referred as “MOBITEK”).

 

DISCLAIMER

MOBITEK makes no representations or warranties with respect to the contents hereof and specifically disclaims any implied warranties of merchantability or fitness for any particular purpose.

Furthermore, MOBITEK reserves the right to revise this publication and to make changes from time to time in the contents hereof without obligation to notify any person of such revision or changes.

Trademarks and Registered Trademarks Products and product names mentioned in this document may be trademarks or registered trademarks of their respective owners.

 

ACKNOWLEDGEMENT

(this section is intentionally omitted)

 

INTRODUCTION

MOBITEK® SMS Gateway Development Kit (SGDK) contains various development kits or software components. SGDK allows software developer and system integrator (SD/SI) to build SMS gateway, SMS application and SMS solution.

One of the kits or components is SMS Application Programming Interface (SMS API ). API is “a specification intended to be used as an interface by software components to communicate with each other.” (source: http://en.wikipedia.org/wiki/Application_programming_interface)

Why use API? Because “a good API makes it easier to develop a program by providing all the building blocks. A programmer then puts the blocks together.” (source: http://www.webopedia.com/TERM/A/API.html)

There are variuos forms of API:-

  1. ActiveX or COM by Microsoft

  2. Java API by Oracle

  3. XML-RPC by Dave Winer of UserLand Software and Microsoft

Previously, MOBITEK had been focusing on developing API on Microsoft OS. Now MOBITEK has developed a new SMS API, MOBITEK® SMS API: XML-RPC that can be used in Linux OS. It is based on XML-RPC.

So what is XML-RPC? “It’s a spec and a set of implementations that allow software running on disparate operating systems, running in different environments to make procedure calls over the Internet. It’s remote procedure calling using HTTP as the transport and XML as the encoding. XML-RPC is designed to be as simple as possible, while allowing complex data structures to be transmitted, processed and returned.” (source: http://xmlrpc.scripting.com/)

 

BENEFITS OF XML-RPC

  1. Simple to use;

  2. Programming language independent – it can be used with Perl, Java, Python, C, C++, PHP and many other programming languages.

  3. Remote calling – application can call the API from remote machine (PC/server), ie. make remote procedure calls over HTTP;

  4. OS independent – implementations are available for Unix, Linux, Windows and the Macintosh.”
    (source: http://tldp.org/HOWTO/XML-RPC-HOWTO/xmlrpc-howto-intro.html)

 

SYSTEM REQUIREMENTS

  1. XML-RPC Server must be running in Linux OS based on Debian and Fedora.

  2. XML-RPC Client can be run in any of these OS:-

    1. Windows

    2. Linux

    3. MAC

  3. XML-RPC Client/Application can be developed by using any one of these programming languages:-

    1. PHP

    2. Java

    3. .Net

    4. C++\

    5. PERL

    6. many more…

  4. MOBITEK® Q24 SMS MODEM (TYPE SGDK)

  5. SIM card

 

LIMITATIONS

  1. SMS API in XML-RPC is a beta product, it is not meant for deployment.

 

LICENCE AGREEMENT

 

  1. MOBITEK® SMS API: XML-RPC (hereafter refer as “API”) is given free of charge. It is completely free of any registration, licensing or deployment fees. It may be deployed freely for use with any third-party software, whether for commercial purpose or not.

  2. The API is supplied on “as-is” basis. You must bear all risks when using it. Therefore, no warranty and support is given.

  3. API must be used together with the MOBITEK® Q24 SMS MODEM (TYPE SGDK) or modem supplied by MOBITEK.

  4. MOBITEK shall not be held liable for any loss nor damage as a result of using the API .

  5. API is at beta stage. It is a pre-release version. It may or may not be compatible with the final version of the API will. MOBITEK may change it for the final version.

  6. MOBITEK may not release a final version of this API.

  7. MOBITEK may or may not provide any fix nor patch for the API.

  8. It is not recommended to use the API to build an application that will be deployed.

  9. It is recommended to use the API for the purpose of research and development.

  10. You grant MOBITEK, without charge, the right to use, share and commercialize your feedback in any way and for any purpose.

  11. MOBITEK makes no warranty, express nor implied.

  12. You have the ability to give feedback about the API to MOBITEK by writing to support2010@mobitek.com.my

  13. The functionality of API depends on the model of the wireless/SMS/GSM modem. Certain model does not support all the functions.

 

INSTALLATION GUIDE FOR XML-RPC SERVER

  1. Connect MOBITEK® Q24 SMS MODEM (TYPE SGDK) with the USB port of Linux PC.

    1. By default, the the modem will be connected at USB port – “/dev/ttyUSB0”.

  2. Create a new subfolder called “SMS_Server_3.12”.

  3. Unzip the zip file called “SMS_Server_3.12.zip” and copy contents to your “SMS_Server_3.12” folder.

  4. To get help on using the XML-RPC Server, in command line, goto the “SMS_Server_3.12” folder and type in the command mark red:-

    user@Debian:~/SMS_Server_3.12$ ./SMS_Server_3.12 -h
    Usage: SMS_Server_3.12 [options]
    Options:
    -h, --help show this help message and exit
    -i <IP address e.g. 192.168.0.1>, --ip=<IP address e.g. 192.168.0.1>
    set the IP address of the local host/SMS server
    -p <port number e.g. 8000>, --ip_port=<port number e.g. 8000>
    set the port number of the local host/SMS server
    -c <e.g. /dev/ttyS0 or /dev/ttyUSB0>, --com_port=<e.g. /dev/ttyS0 or /dev/ttyUSB0>
    set the com port where GSM modem is connected
  5. To start the XML-RPC Server, in command line type

    user@Debian:~/SMS_Server_3.12$ ./SMS_Server_3.12 --ip=192.168.10.204 --ip_port=8800 --com_port=/dev/ttyUSB0
    1. “ip” is the IP address of the local host/SMS server; it is also where your XML-RPC Client must point to;

    2. “ip_port” is set the port number of the local host/SMS server; it is also where your XML-RPC Client must point to;

    3. “com_port” is the com port where GSM modem is connected to.

  6. If the XML-RPC Server is configured and started, this message will appear on screen:-

    Sat Jul 7 16:51:57 2012 || SMS server has established a connection with SMS modem at COM port '/dev/ttyUSB0'.
    Sat Jul 7 16:51:57 2012 || SMS server has been initialized at 192.168.10.204:8800. Waiting for request from client.

 

INSTALLATION GUIDE FOR XML-RPC CLIENT (PHP)

  1. Unzip the PHP sample code that contains:-

    1. CheckSMS_Index_1.0.php

    2. CheckSMS_Total_1.0.php

    3. Delete_SMS_1.0.php

    4. Read_SMS_1.1.php

    5. Send_SMS_1.1.php

    6. xmlrpc.inc

  2. If necessary, copy the XML-RPC library file “xmlrpc.inc” to the folder “lib” of PHP server.

  3. Edit the IP address and port number (mark red) to match them with the XML-RPC Server.

    //-------------- XML RPC Client Configuration ......................
    //create connection string to SMS Server (XML-RPC Server)
    5$c=new xmlrpc_client("http://192.168.0.204:8888");
  4. Use any web browser to run the PHP sample code.