Calling an external API from Microsoft Dynamics Nav - web-services

I am researching how to integrate Microsoft Dynamics NAV with my existing REST API (built on Django REST Framework). What I would like to do is trigger API calls from NAV to CRUD objects via the REST API.
Reading the web services docs for NAV, it seems clear that NAV can expose a web service for other software to consume from. But can NAV consume 3rd party APIs? In the web services examples documentation, it says:
Solutions that need to execute business logic or read data from
Microsoft Dynamics NAV are candidates for Web service implementation.
These can also be solutions that write data to Microsoft Dynamics NAV
and validate the data using existing business logic.
Also, it gives the following example of how to use web services:
Execute any kind of business logic that is more easily developed and
managed in Microsoft Dynamics NAV.
However, I don't see any examples of data writing. It doesn't seem that in the exposure of web service pages or codeunits, there's a way to make calls to 3rd party APIs and execute business logic with the data that comes back within NAV. Is this actually possible?

Unfortunately not, no.
You do however have access to the full .NET framework from within the 'Development Client' of Dynamics NAV - When defining your variables select the Type of DotNet
It's far from perfect, so for larger tasks I'll create AddIns or completely external libraries (depending on version).
For something smaller like this I personally find it easiest to write it in C# as a small (console) app and the 'translate' it back into Dynamics NAV.

If you are looking for way to invoke a web service then why do you need Nav web services? Nav web services is a way to call Nav.
These can also be solutions that write data to Microsoft Dynamics NAV and validate the data using existing business logic.
This means if you invoke published Nav web service then you can pass data to your call and the data will be validated and saved to Nav. So this is about how to push data to Nav, not pull from external system.
If you want to invoke a web service from Nav consider this options:
Write external wraper library (as mentioned by #SeeSharp or as described). Then use it in C/AL as DotNet or Automation types of variables.
Use existing libraries like 'Microsoft XML, v6.0'.XMLHTTP60 right in C/AL to make http calls to your web service.
Do it Navision style.
Last damn option is to write console application that will consume your web service and call it from Nav using shell. This is not an option, I know.

Related

Integration between custom system and Crm Dynamics 2016 Online

I'm working on Dynamics since about 1 year, and I'm working on "on premise" environments, and I don't know very much about online solutions.
I should now integrate 2 systems through webservice, and one of them involves Microsoft Dynamics CRM Online 2016.
What I'm trying to accomplish is that the custom systems sends data to the CRM Online through webservice.
I've read I just can't deploy my webservice and my logic as I've always done (separate web application that receives a Json or a XML through web services and works on CRM entities through the SDK).
So, do I need a separate machine to receive the XML and working on the CRM through the SDK?
In some posts I learn a little about Azure, but I don't know if it could be a nice solution. Should I get a virtual machine and then install IIS? Will my web app be visible by the custom system and able to work on the CRM online? Do I need a different service?
Thanks in advance and sorry for the confusion, it's the first time I'm trying to make CRM Online communicate with the outside.
So if I understand correctly your approach is 'custom system <=> your WS <=> CRM Online 2016
I've read I just can't deploy my webservice and my logic as I've always done (separate web application that receives a Json or a XML through web services and works on CRM entities through the SDK).
In CRM Online you don't have access to machine that CRM stands on so no folders, no inetmgr, no deploy.
So, do I need a separate machine to receive the XML and working on the CRM through the SDK?
Yes.
Should I get a virtual machine and then install IIS?
It doesn't have to be new virtual machine. It could be for example machine that custom system stands on ofc. if it can be configured to have access to the internet.
Will my web app be visible by the custom system and able to work on the CRM online?
It is matter of configuration of NAT, firewall etc.
Do I need a different service?
What service do you reffer here?

Can Mirror Api call an external web service?

I want to develop an app with mirror api for the novel google glasses. Is it possible to call an external web service from the glassware? I have to use this web service to obtain the informations to display in the timeline cards.
If it is possible, how I can do it?
You need to provide a web service that interacts with the user's timeline to insert cards, but you can interact with whatever other web services you want from within yours in order to get the data that you push. Something like this:
insert timeline get 3rd party
cards data response
User's <-------------- Your Mirror <------------- Third party
Glass --------------> web service -------------> web service
subscribed make request
notifications for 3rd party
(menu items, data
location)
The simple answer is YES.
You'll probably want to develop your Glassware using the Google Mirror API as a server-based web application. (This doesn't require you to run any code on Glass, instead your application is written in PHP, Java, Python, .NET or one of the other languages supported by the Mirror API and resides on a web/cloud server.)
Your web-based application can then make any sorts of web-based API calls to other external web services or APIs, retrieve data or information and then format and send this information to your Google Glass device. How you consume these 3rd party web-services depends on your choice of programming language, but pretty much all of these languages have support for consuming external web service via XML, REST, JSON or SOAP.

Difference between portlet and a webservice

I am not sure if I am comparing onion with a cabbage. But I am really confused with the portlet and a web service. I know that web service is making your software components in your application as a service to other applications but to me it is similar to a portlet responding to requests. I know that my understanding is making you(Portlet & SAAS developers) really upset. But I need some clarity on this.
Why cannot I use the request-response to portlet work similar to a web service?
If yes, what is the benefit I get in using a web service than a portlet?
If not, then what are portlets lacking to act as a web service?
I am a newbie in portlet development. Please dont curse me for this question.
Please suggest.
EDIT:
Most of the answer say that the portlet is a UI component. My customer has requested me to create a webservice in liferay. So is it to make a portlet as a web service? If yes, can you please provide a pointer or some code snippet?
Addressing your 'edit' specifically with regards to Liferay...
Liferay plugin projects can expose web services without too much work.
The Liferay Service Builder actually has facilities so you can create SOAP web services or JSON web services backed by tables in the Liferay database (and that make queries on existing database tables). In the case of JSON web services, the URL scheme generated is not RESTful (unfortunately), but it is well defined. With a bit of work on your part you can impose Liferay's permission system on web service calls as well.
Here's a reasonable starting point in the Liferay Developer's Guide:
See the links on that page to SOAP and JSON services.
Note that a 'portlet' is only one type of Liferay plugin. The web service facility is part of the service layer - which can be used by many plugin types. So there isn't necessarily a portlet involved in creating a web service in Liferay, you can make a web service that has no visual component associated with it.
Portlets are areas you create to add and display content. Portlets can be added to the left and right of the center body area and can contain myriad content ranging from news, events, calendars, RSS feeds, collections, plain text, and more. Also, you can set properties and policies for showing the portlets.
you want to use portlet when
You have content you want to have special focus, like news.
You need to specify the configuration data for an item. - i.e. number of entries to show.
You want to give the content editors a choice about when and where to display content.
You'd like to show it only to some groups or users.
On the other hand, web services:
Enables applications to expose their services
“progammatically”, i.e. the services can be invoked by programs
Enables software running on other computers (could be a desktop, mobile phone, PDA, etc.) to invoke operations exposed by Web applications
if you are trying to identify the main difference portal historically, the portlets have three layers architechture (client, middle tier, backend) this cause two weakness:
Different portal groups have no well established way of sharing services
Different technologies(Java, Perl, CORBA, EJB) in middle tier.
Different protocols(GRAM, IIOP,...)
Consequently, lots of redundancy, reinvention
Example: batch script generation
so Web services address the service sharing problem and reduces the redundancy.
source1 source2 source3
Portlets are meant to be a user interface component in a portal solution.
Web Services provide functionality to remotely interact with a system commonly using SOAP, REST, JMS or other related
They provide completely separate functions. The closest you get is the serveResource method in portlets. This functionality is used to serve various types of content from a portlet (such as a PDF document or an AJAX response) without the need to perform a full page request.

Is it possible to make a call out to a remote server from within a SharePoint 2013 app?

I am very new to SharePoint development as well as SharePoint overall, so I apologize if this question seems like a no-brainer. I'm currently working on a SharePoint 2013 app and I'm wondering if it's possible to make a call out to some URL from within the SharePoint environment. Basically, I want to do this within an event receiver after some action is done to a list, and from there I want to make a call to some web service on my server to update my system. Using the REST API to poll the SharePoint server isn't a good option for this scenario since it won't scale very well.
When dealing with SharePoint 2013 apps you can access any resource using standardized APIs. In addition to REST SharePoint is offering the JS Client Object Model (CSOM).
In order to access data from another web than the current one, your app needs the permission to interact with the entire tenant.
If you're trying to query data from another host, you have to use JSONP because of the same origin policy.
if you are building an app using the "new App Model" for wiring up Remote Event Receivers it is possible to do anything, in which your app hosting framework/environment allows you to. If you are building a Classic App (Farm Solutions) you'll have access to perform operations which are allowable from the SharePoint servers directly...typically this is a lot as GAC deployed assemblies are granted full trust.
depending on what you are trying to do and what kind of resources you app will consume. I'd consider moving the dependancies away from SharePoint and building using the new App Model versus the older farm solutions. As you sound like you are starting in SharePoint, this gives you an opportunity to learn the new ways of doing development for SharePoint.
Lastly, you might consider building a workflow. Not sure what kind of app you are building but the new workflow capabilities include actions which can make RESTful calls. Potentially making your application a "no code" solution. Again it all really depends.

Microsoft Dynamics CRM -- Do people build websites with it?

Forgive my ignorance, but do people build websites with Microsoft Dynamics CRM?
I have a potential client who says that is the technology they will use for a new web project, for which I would be doing the HTML templating. I want to learn all I can as I am new to this particular system, but I can't seem to find anything related to web building and CRM. Is it more likely the client is using another piece of technology that they are neglecting to tell us about?
Any experience or insight about this process is greatly appreciated!
You can't build website using MSCRM, but you can build ASP.Net website using CRM content easily. The API provided by MSCRM is a set of web services, that can be queried in a website to populate pages content.
Also, you can directly query the Database if you want ReadOnly content, and only for read-only content, because it is not supported to update/create data using SQL connections.
Note that it's required to have the external connector license to use any data in the CRM, thru the API and even thru direct SQL queries.
I have built a website using .NET, utilising the CRM4 API and database. All the website did was to submit queries to CRM using the CRM web services and metadata web services, and get data back. This company was already using CRM for their back end, so it's much easier for the front end to use the same database as well since it's a simple one.
The alternative would be to create an intermediate connector between the 2 systems -- backend and front end, which is not as efficient (for our case anyway).