Skip to Content
Recently i cam across a webservice (available for free at http://www.webservicex.net/WS/WSDetails.aspx?CATID=4&WSID=59) which can send SMS to select GSM network phones in India. Just wanted to let the community know and get benefited from the same.

WSDL for this webservice is available at http://www.webservicex.net/SendSMS.asmx?WSDL

This webservice covers the following networks in India – Airtel, Idea Cellular, Skycell , RPG Cellular, Hutch, Celforce / Fascel, BPL Mobile, Escotel.

If you are on WAS6.4

Follow the steps explained in the weblog titled BSP a Developer’s Journal Part XIV – Consuming WebServices with ABAP by  Thomas Jung  (follow the method described under the subheading ‘Release 640‘) to create the client proxy and the program to execute the proxy to consume the webservice. Thomas has explained it well with screen shots on how to create the client proxy and also given a sample program to consume the same, and i don’t feel a need to re-explain the same here.

If you are on WAS6.20

Create a report program from se38 and copy/paste the code below.

REPORT y_sms_to_india620.
DATA: http_client TYPE REF TO if_http_client .
DATA: wf_string TYPE string ,
result TYPE string ,
r_str TYPE string .
DATA: result_tab TYPE TABLE OF string.

SELECTION-SCREEN: BEGIN OF BLOCK a WITH FRAME .
PARAMETERS: mail(100) LOWER CASE,
 m_no(20) LOWER CASE ,
m_mss(120) LOWER CASE.
SELECTION-SCREEN: END OF BLOCK a .

START-OF-SELECTION .
 CLEAR wf_string .
 CONCATENATE
 ‘http://www.webservicex.net/SendSMS.asmx/SendSMSToIndia?MobileNumber=
 m_no
 ‘&FromEmailAddress=’
 mail
‘&Message=’
 m_mss
INTO
 wf_string .

 CALL METHOD cl_http_client=>create_by_url
 EXPORTING url = wf_string
 IMPORTING client = http_client
 EXCEPTIONS argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4.

CALL METHOD http_client->send
EXCEPTIONS
http_communication_failure = 1
 http_invalid_state = 2.

 CALL METHOD http_client->receive
 EXCEPTIONS
 http_communication_failure = 1
http_invalid_state = 2
 http_processing_failed = 3.
 CLEAR result .
 result = http_client->response->get_cdata( ).

 REFRESH result_tab .
 SPLIT result AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab .
LOOP AT result_tab INTO r_str.
 WRITE:/ r_str .
 ENDLOOP .

 

I tried this from Saudi Arabia to a BPL mobile at Trichy/India and it works!

To report this post you need to login first.

44 Comments

You must be Logged on to comment or reply to a post.

  1. Craig Cmehil
    Great job! Here we actually have an SMS gateway but for some companies this is not feasible and so alternatives like this can prove to be invaluable!!

    Excellent job!

    (0) 
    1. ganesh jonna
      Hi,
      How is it working for you now? Can you explain, where you went wrong before?Bcoz i got response in HTTP Client prog but i did not receive msg in my mobile.
      Thanks
      (0) 
  2. ganesh jonna
    Hi,
    Iam doing HTML->Webservice scenario and am using HTTP Client prog for sending request.
    In my HTTP Client prog I got the response, the same response should be recived by my mobile as SMS, but it did not happen? What else needs to be done?
    Thanks a lot
    (0) 
    1. Durairaj Athavan Raja Post author
      you are sending SMS from ABAP program, so the ABAP program will get the status message, if you want your mobile to receive the status message, use the same logic to send the status message to your mobile from the ABAP.

      Regards
      Raja

      (0) 
      1. Hi Durairaj,
                I tried using the Web Service in ECC 6.0 with Web Dynpro ABAP as front end to get the inputs. When I execute the service I get the result as Message Sent Successfully for BPL Mobile Number but the SMS doesn’t reach the recepient. Could help me with troubleshooting this problem?

        Regards,
        Supriya.

        (0) 
  3. nikhil kelkar
    Hello Sir,
          this weblog is really helpful for me for understanding about consuming web services from abap. I am trying to execute the sample program given by you but received above exception in method http_client->receive. Please guide me and let me know if I am missing any required configuration.
          Thank you.  
    (0) 
    1. Durairaj Athavan Raja Post author
      do you connect to internet via proxy? then you need to either code code the proxy authentication in the program or maintaint it at system level (SICF->Client=>Proxy Settings)

      Regards
      Raja

      (0) 
  4. Pritam Kunal
    Hi
    I have tried doing code as you have mentioned. but i am still not able to configure the font size and all that you have mentioned. could you please tell me how to configure that? and where it need to configure it to.

    I have seen many replies that they are saying the code is working but i am not able to do so.

    Please help me for the same.

    Thanks in advance
    Pritam

    (0) 
      1. hello sir,
              i used the same code but i’m not getting error message but the message is not reaching the target phone as well.

        Could you please let me know what exactly i need to do here ?

        Thanks & regards,
        JOmy

        (0) 
  5. Swarna Ramya
    I’m also having the Same Problem that Vishal is Having.Whether I have to do any Additional Configurations ?

    Please Help me in this.

    Thanks & Regards.

    (0) 
  6. <br/>Hi iam Getting like This When i Execute The Program can u please solve my problem<br/><br/><br/><br/><html><head><title>Application Server Error</title><br/><style type=”text/css”><br/>body { font-family: arial, sans-serif;}<br/></style><br/></head><br/><BODY text=”#172972″ link=”#808080″ vlink=”#808080″<br/>alink=”#8e236b” bgcolor=white  leftmargin=”0″ topmargin=”0″<br/>marginheight=”0″ marginwidth=”0″><br/><table height=”61″ width=”100%” border=”0″ cellspacing=”0″<br/>cellpadding=”0″><tr><td background=”http://mytecsap02.mytecsoft.com:8001/sap/public/icman/img/bluebar_tile.gif“<br/>height=”30″><table> <tr> <td width=5></td> <td width=20% nowrap><font face=arial size=”-1″ color=white>SAP Web Application Server<br/></font></td><td width=75% align=”right” nowrap><font face=arial<br/>size=”-1″ color=”white”>Help

    !http://mytecsap02.mytecsoft.com:8001/sap/public/icman/img/theme.jpg|height=61|alt=SAP|width=122|src=http://mytecsap02.mytecsoft.com:8001/sap/public/icman/img/theme.jpg|border=0!
     

    404 Resource not found

    Partner not reached


    Error: -20
    Version: 7000
    Component: ICM
    Date/Time: Mon Sep 15 16:57:00 2008#
    Module: icxxconn.c
    Line: 2314
    Server: mytecsap02_IDS_01
    Error Tag: {00027a4e}
    Detail: Connection request from (26/1696/5) to host: proxy, service: 8080 failed (NIEHOST_UNKNOWN)#RM-T26, U1696, 800 DEVELOPER, mytecdtp018, 16:56:56, M5, W7, SE

    </FONT><br/></td></tr></table><br/></body></html><br/><br/><br/>

    (0) 
  7. sanjay khatri
    Raja,
    It required & work on Centerl instance only,I confirgured HTTP NODe in SCOT and test sms is going , How can I using this program ? So that RFC which I crated work usign HTTP NODe and I can Monitor using T-code sost,

    Pl.Help

    (0) 
    1. Rehman M H
      Hi Experts
      I tried the same code,but i am also getting the same error as others mentioned in the blog.Pls guide me as to what extra configurations have to be made to send an sms.
      (0) 
  8. sanjay khatri
    Thank A lot for this code , It work perfectly need only little bit adding of Code,
    this program workin won Cental instance only where in background mode, where as I would like run on any aplication server for that I create RFC for desired URL and also configured HTTP node.

    it is workign with HTTP client proxy setting which direct connection from program and URL

    I need help how can we attach this program with HTTP node sothat we can monitor through SOST.

    sanjay

    (0) 
  9. madan namdeo

    Hi Sir,Help

    !http://shaktidev:8000/sap/public/icman/img/theme.jpg|height=61|alt=SAP|width=122|src=http://shaktidev:8000/sap/public/icman/img/theme.jpg|border=0!
     

    404 Resource not found

    Partner not reached


    Error: -20
    Version: 7000
    Component: ICM
    Date/Time: Mon Oct 06 13:36:34 2008#
    Module: icxxconn.c
    Line: 2321
    Server: shaktidev_SPD_00
    Error Tag: {00012467}
    Detail: Connection request from (33/758/0) to host: http://www.webservicex.net, service: 80 failed (NIEHOST_UNKNOWN

    </FONT><br/></td></tr></table><br/></body></html><br/><br/><br/><br/>Thnaks in advance<br/>

    (0) 
  10. pallavi chandu

    <?xml version=”1.0″ encoding=”utf-8″?><br/><SMSResult xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns=”http://www.webserviceX.NE<br/>  <FromEmailAddress>chandrababu.g@wentregue.com</FromEmailAddress><br/>  <MobileNumber>919243444741</MobileNumber><br/>  <Provider>Not Covered</Provider><br/>  <State>Not Covered</State><br/>  <Status>Not Covered</Status><br/></SMSResult>

    (0) 
  11. Hello Durai,
          Could you please let me know what i need to do since the message is not reaching to the Mobile even though i got Message Sent successfully message ?
    (0) 
          1. Hello Durai, 
                  Do you have any other way for example, any other Webservice or other method by which i can send SMS from a ABAP program ?

            Thanks & regards,
            Jomy

            (0) 
  12. Sai Krishna

    i’m getting the response of application error give the possible ways to overcome this issue if u figured it .but i deeply appriciate u on ur fantastic work dude  i’m pasting the screen i got on ur exceution of ur program go through that and check out to avoid to get sucessfully to transmitt my message to the mobile from abap<br/><br/><br/>&—-


    &
    <br/><br/><br/><br/><html><head><title>Application Server Error</title>     <br/><style type=”text/css”><br/>body  font-family: arial, sans-serif;<br/></style><br/></head><br/><BODY text=”#172972″ link=”#808080″ vlink=”#808080″<br/>alink=”#8e236b” bgcolor=white  leftmargin=”0″ topmargin=”0″<br/>marginheight=”0″ marginwidth=”0″><br/><table height=”61″ width=”100%” border=”0″ cellspacing=”0″<br/>cellpadding=”0″><tr><td background=”http://mytecsap02.mytecsoft.com:8010/sap/public/icman/img/bluebar_tile.gif“<br/>height=”30″><table> <tr> <td width=5></td> <td width=20% nowrap><font face=arial size=”-1″ color=white>SAP Web Application Server<br/></font></td><td width=75% align=”right” nowrap><font face=arial<br/>size=”-1″ color=”white”>Help

    !http://mytecsap02.mytecsoft.com:8010/sap/public/icman/img/theme.jpg|height=61|alt=SAP|width=122|src=http://mytecsap02.mytecsoft.com:8010/sap/public/icman/img/theme.jpg|border=0!
     

    404 Resource not found

    Partner not reached


    Error: -20
    Version: 7000
    Component: ICM
    Date/Time: Fri Jul 09 15:53:45 2010
    Module: icxxconn.c
    Line: 2321
    Server: mytecsap02_IDS_10
    Error Tag: 00017adb
    Detail: Connection request from (18/2855/0) to host: proxy, service: 8080 failed (NIEHOST_UNKNOWN)
    RM-T18, U2855, 800 DEVELOPER, mytecdtp014, 15:53:39, M0, W5, SEU_, 3/2

    </FONT><br/></td></tr></table><br/></body></html><br/><br/><br/>

    (0) 
  13. Deepmala Patel
    i am using the sms from sap to send sms .
    while using sms some time it give error
    like this

    (1) the specified serial port is not avalable

    (2)

    can some one tell me why it is coming

    (0) 
  14. Aditya Niyogi
    Hi Guys,

    This was a great article and it helped me configure the SMS settings for my client.
    I was facing the NIEHOST_UNKNOWN error for a long time and there was no solution from our BASIS team. Further analysis revealed that the DNS settings were not proper.
    A few things that can be done in this case :
    (1)Check the DNS settings of the server
    (2)Try to put the IP address of the service instead of http://www.domain.com name. This will solve 90% of the problems
    (3)Check the HTTP ICF settings and see if the port is working using netstat(AIX) command.

    Hope this helps others as I had to dig deep to find the solution.
    Thanks,
    Aditya

    (0) 
  15. Gokulan Natarajan

    Hi Durairaj,

    Your code really helped me to send sms well. But my requirement exceeds message length. Can we increase message length.

    Regards,

    Gokulan N

    (0) 

Leave a Reply