SmS through XML

navuser1navuser1 Member Posts: 1,329
Dear all,

I have an XML Format :



How to use this in Navision 2009 SP1 to send SMS ??

kindly share our knowledge.
Now or Never

Comments

  • kinekine Member Posts: 12,562
    You need to somehow send this XML to correct provider which will use it to send the sms. I assume that you will have some URL of their webservice and you need to send this XML as part of WebService request, e.g. through SOAP protokol. Just search this forum for how to consume webservices. You will find examples...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • navuser1navuser1 Member Posts: 1,329
    I have created the xml file through C/AL(code given below) in Navision(Classic Client) now I want to send this to the provider (http://keepsmsing.com/myhome/RequestListener). What should I do ? Kindly relpy.

    Thanks you.
    CREATE(xmlDoc);
    xmlMgt.SetNormalCase;
    xmlProcessingInst:=xmlDoc.createProcessingInstruction('xml','version="1.0"');
    CurrNode := xmlDoc.appendChild(xmlProcessingInst);
    CurrNode := xmlDoc.createElement('TICKJL');
    CurrNode := xmlDoc.appendChild(CurrNode);
    xmlMgt.AddAttribute(CurrNode,'version','1.0');
    xmlMgt.AddElement(CurrNode,'request','','',NewChild);
    xmlMgt.AddAttribute(NewChild,'userID','pass001');
    xmlMgt.AddAttribute(NewChild,'password','pass002');
    xmlMgt.AddAttribute(NewChild,'pin','0006');
    xmlMgt.AddAttribute(NewChild,'Type','push');
    CurrNode:=NewChild; //one level deeper
    xmlMgt.AddElement(CurrNode,'publishData','','',NewChild);
    xmlMgt.AddElement(CurrNode,'FromAddress','ASDRF','',NewChild);
    xmlMgt.AddElement(CurrNode,'Message','Your Message Here','',NewChild);
    xmlMgt.AddElement(CurrNode,'AddressArray','','',NewChild);
    CurrNode1:=NewChild; //One level deeper
    xmlMgt.AddElement(CurrNode1,'address','9051720463','',NewChild);
    xmlMgt.AddElement(CurrNode,'ScheduleTime','','',NewChild);
    
    xmlDoc.save('D:\xmlFile1.xml');
    
    Now or Never
  • GRIZZLYGRIZZLY Member Posts: 127
    Sincerely yours, GRIZZLY
    Follow my blog at http://x-dynamics.blogspot.com
  • navuser1navuser1 Member Posts: 1,329
    GRIZZLY wrote:

    Unable to create Xml file through the approach you described.
    You wrote:
    RequestText := xmlBegin +
    '<Package....
    .....
    .....
    '</Package>';

    What is xmlBegin ?
    kindly reply.

    Thanks!!!
    Now or Never
  • GRIZZLYGRIZZLY Member Posts: 127
    It's a Text constant:
    <?xml version="1.0" encoding="utf-8" ?>
    Sincerely yours, GRIZZLY
    Follow my blog at http://x-dynamics.blogspot.com
  • navuser1navuser1 Member Posts: 1,329
    Thanks for your reply...

    Code which is still not working given below...
    SMSTable.GET();
    CLEAR(XMLRequest);
    IF ISCLEAR(XMLRequest) THEN
       CREATE(XMLRequest);
    
    text :=xmlBegin+
    '<SMS version=1.0>'+
    '<request userid="'+SMSTable.ID+'" password="'+SMSTable.Password+'" pin="'+SMSTable.PIN+'" type="'+SMSTable.Type+'">'+
       '<publishData>'+
          '<fromAddress>'+SMSTable.Type+'</fromAddress>'+
               '<messageTxt>Your message here</messageTxt>'+
                  '<addressArray>'+
                     '<address>9051720463</address>'+
                   '</addressArray>'+
         '</publishData>'+
         '<scheduleTime></scheduleTime>'+
    '</request>'+
    '</SMS>';
    
    IF NOT XMLRequest.loadXML(text) THEN ERROR('Request Failed');
    XMLRequest.save('D:\xmlFile4.xml');
    
    IF ISCLEAR(HTTP) THEN CREATE(HTTP);
    HTTP.open('POST','http://www.msing.com/home/ReqListener',FALSE);
    HTTP.setRequestHeader('Content-Type','text/xml');
    HTTP.send(text);
    

    XMLRequest.LoadXML gives an error message('Request Failed').
    Kindly reply..
    Now or Never
  • GRIZZLYGRIZZLY Member Posts: 127
    It means your xml document is not well-formed.
    Try to add double quotes in constant:
    '<SMS version="1.0">'+
    Sincerely yours, GRIZZLY
    Follow my blog at http://x-dynamics.blogspot.com
  • navuser1navuser1 Member Posts: 1,329
    It's done.
    Thanks!
    Now or Never
  • GRIZZLYGRIZZLY Member Posts: 127
    U're welcome!! 8)
    Sincerely yours, GRIZZLY
    Follow my blog at http://x-dynamics.blogspot.com
  • navuser1navuser1 Member Posts: 1,329
    Now! I'm trying the whole thing within SQL Server (version 2008).
    Now or Never
Sign In or Register to comment.