Labels

Showing posts with label Web-service. Show all posts
Showing posts with label Web-service. Show all posts

Friday, September 28, 2012

Simple notification service

In Microsoft Dynamics NAV 2009 platform new triggers OnDatabaseInsert, OnDatabaseModify, OnDatabaseDelete, OnDatabaseRename were added. They are fired even in code you don't call triggers  INSERT, MODIFY, DELETE with TRUE arguement. In standard functionality these triggers are used for integration with Microsoft Dynamics CRM product.
The Business Notification Server functionality is too complex and requires some additional granules, that costs some money. So, I 've created the alternative lightweight universal solution for notification. IT manager has the possibility to subscribe user for special events on any table. And user will get notification in his mailbox.

Tuesday, July 19, 2011

Using web-service to send SMS from NAV

Recently I had a task to send SMS notification through the Webservice.
My service provider use following interface protocols.
Request for sending SMS:
Where:
  • login and password are the authentication parameters;
  • id is the internal message ID;
  • recipient is the mobile phone number of the recipient;
  • sender is a sender description;
  • text is a message text.
This request should be posted to a webservice via HTTP or HTTPS.

Tuesday, June 21, 2011

Web service for Dynamics NAV (server-side)

Today I would like to discuss with you how to implement a Web service for Dynamics NAV and to interact with this service from Dynamics NAV C/SIDE Client or even web server.

My target was to build a NAV database (because employees are used to work with it's interface) with online access. In this online database additional information about customers (such as bonus balance) should be stored. Information about customer bonus balance should be available not only in NAV working database, but in internet, too. Further more, when posting a discount in NAV operational database, customer bonus balance should be reduced.

From the system point of view, the Navision Application Server, connected to bonus database, should be started. Certain TCP ports should be opened. When the message come to this port some event should be triggered, and a response should be posted back. The language for this interaction should be XML.

Codeunit 1, Trigger 99 NASHandler(ATASID : Text[260])
GenSetupL.GET;
GenSetupL.TESTFIELD("NAS Application Port");
IF ISCLEAR(CC) THEN CREATE(CC);
IF ISCLEAR(SBA) THEN CREATE(SBA);
CC.AddBusAdapter(SBA, 0);
SBA.OpenSocket(GenSetupL."NAS Application Port", '');
MESSAGE(StartedNASTxt, GenSetupL."NAS Application Port");

where
CC Automation 'Navision Communication Component version 2'.CommunicationComponent
SBA Automation 'Navision Socket Bus Adapter'.SocketBusAdapter
are the global variables. After adding CC variables the new trigger was created automaticly:
CC::MessageReceived(VAR InMessage : Automation "''.IDISPATCH")
Then the new trigger for proceeding incoming request was created and the next code was added: