Can Mirror Api call an external web service? - web-services

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.

Related

Calling an external API from Microsoft Dynamics Nav

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.

Web application as a client for web service

I am new to Web development. And hence, if the question is dumb, please be polite. For creating my application, I had to take a decision of whether writing a web service or a web application. After searching a few questions in stackoverflow, I came to know that, web service is something which doesn't involve human interaction. And web application is what human uses ( the UI/web page kind of stuffs ).
But lately, I saw gmail is a web service ( email service ). But I was confused from here on, because, gmail provides a UI, and human interactions do occur. And from there on, I got confused again.
So what I figured out from this is, gmail website is like a web application for users to use directly. The web application in turn uses the web service provided by Google for email. Is my understanding right? So can a web application be a client for web service?
If I am wrong somewhere, please do correct me. I hope to be clear after someone throws light on this with some good example. Thanks in advance.
You are quite right. Basically a Web Service has several endpoints over HTTP (normally) that provides data (generally in JSON or XML) and are meant to be consumed by Web Clients. Sometimes the are also called Web API's (Application Program Interface).
A Web Application is quite similar to a Web Service but it provides an interface where the user can interact with. Usually Web Applications are consumers of Web Services or Web APIs.
Following your example, Google email is could be considered as both, a Web Service and a Web Application. It is a Web Service because it provides a set of HTTP endpoints that works independently of its Web UI Application (GMail). In fact, you can find third party Web Apps that interact with the Google email Web API.
This concept is very important when designing Web Solutions. Ideally you want to design and implement a good Web API, usually a RESTful Service (in JSON/XML). Then you or others will be able to implement different types of applications (Web, Mobile, etc.) because of this API.

where to use web services

I am discovering webservices to impliment in my asp.net website. I visited many sites about Why use webservices and read many articles and found out that web services are good when you have something that is used frequently without loading your page.
I want to know some other example scenarios where web services are used.
Whether i can use web services in sending an order form to database or it is just for textbox box auto completion like google and etc.
Note: I know web services can be used from mobile, web or desktop applications.
But My question is When do i use web service in ASP.Net Application?
Some articles read so far
Codeplex
How to create a Web service using Visual Studio.net
w3school
On a Large Scale, Webservices are basically written, when you want to expose your database, your code, to some other user.
By exposing database, means, suppose, you have a large collection of all the pharmaceutical companies in a given region, storing details in db like, medicines they produce, their policies etc etc. And now, you want people to use it(possibly your paid Client, or simply free access to anyone). So what you going to do? Obviously broadcasting working connectionString to your database will be a disastrous move.
So what you do is to make few methods on top of your db i.e. CRUDE operations and expose these methods in your WebService i.e. someone can interact with these methods through a URL and fetch data or send data or both.
Most general use of WebServices is when you want your specific language built( say ASP.NET) logic and data to be accessible to people on different platforms.
Like mobile devices. Their frontEnd is built in fancy framework say like Titanium, but they fetch their data through a Sql Server using WebService built with Microsoft's WCF-Rest approach. They store their data, Synch their data through a WebService.
In a typical example, We had a very large shopping Website, and it was standalone i.e. we were the only users of its database, its data, its users. But then a requirement came, that certain Client wants to model it and make use of its existing data and logic, but they have got JAVA platform. Our entire system was built on ASP.NET 3.5. What to do then. We simply exposed our BAL through a ServiceLayer and gave it a fancy name ServiceBAL and lived (and earned) happily ever after.
These are some business oriented usage of Web Services.
Other simple, mere usage of webService like textBox auto completion, existing user check and so many, am sure, you must have found out during your scout.
Web services are reusable components you can use anywhere. for example suppose you are building order processing system where order can be place by mobile,web etc. So instead of creating a different function for different application or different platform it's better to create a web service of order processing system such as placeOrder or takeOrder web service and consume them on different applications.
Web Services are the means by which devices communicate over the World Wide Web.
Whether you use a mobile application, search engine or an enterprise system, the user piece of the application (the interface) resides on your device.
The data, and potentially the business rules, live on some other server on the network. How your interface communicates with the server piece is the role of Web Services.

Difference between web services and web application

Lets have an example scenario:
Client opens a web site and finds the sum of two numbers which he enters from the textboxes.Then clicks on the ADD button.Two parameters are HTTP GET'ed to server where PHP code is written to add the numbers and result is echo'ed.
Based on this scenario could anybody explain the difference between Web services and application?
In your case if you have User Interface for providing two numbers and then getting the result, it should be called a web application. But if you have an API exposed to receive two numbers and return result over http , then it should be called a web service.
At low level, both Web application and web service are kind of same thing. But the main point is that web services are for machine/program to machine/program communication whereas Web application is for Users.
I'd say that web applications are intended for users and web services are intended for other applications. That's the most important difference. Web applications usually present data in HTML which looks nice to the user and web services usually present data in XML which easy to parse by other applications.
A person drives a car. That car could be powered by an internal combustion engine, electric motor, or nuclear reactor. The power source doesn't matter to the driver though, as all they need to see are the controls and the road ahead.
The application is the car. Web services are the nuclear reactor.
To add 2 no.s we write a web service, to subtract we write a diffrent web service, however calculator is an web application that uses add,subtract and many other webservices in combine.
Lets take an example of Google search.
We can use Google search in two ways. First, we can visit http://www.google.com and put out query for search. Google the returns the result. Second, we can integrate Google Search in our websites with custom search API.
In first case Google Search is acting as web application while in second example it is acting as web service.
Here we can point out few differences,
User interacts with web application while machine interacts with web service.
To access web application, one must visit application. While web service can be access from anywhere (from any application which integrated it). We don't need to visit the service explicitly.
A webservice is equivalent to a method in java that has a web wrapper around it. It lives on the server and it can be sent data / queried etc. and may or may not return a result. It does not have any front end it can only be accessed via http get, put, delete etc.
A web Application is a fully functional piece of software that lives on a sever that is designed to help people achieve a task. This would have a front end that would allow users to interact with it / enter data etc.
A web application could use multiple webservices to achieve its goal / end result
There is little difference between web application and web services.
Web Application: In web application when user request any data then the server embeds the response into some HTML and forward it to the user and on browser the HTML is rendered.
While in web services it's done differently that when some user requests for some data then the server returns it a json or XML array of objects and the data can be displayed by anyway the web designers wants.
Thanks Hope it resolves the matter.
Web service is for application consumption , invoked through web application
To communicate with webservice data should be sent as SOAP message or as REST i.e XML over HTTP
Most of the times web service is not part of application because to facilitate the use by other web applications and it is not for direct consumption to end users
Web application is for human consumption invoked directly by GUI which may or may not use web service for giving response

Communication via Webservice

This is really a stupid question.. I really can't figure this out so need help
Basically, our web application will exchange data with another software company web application. That company has already exposed their webservice, and we can perform crud operation via their rest api. If we can full fill our requirement via their rest api, do my software company need to build our own webservice server? In which case do company build their own webservice server?
You should only need to create a webservice on your side if the other application needs to request and consume data from your application. If you're merely passing data to their API and consuming the response, there should be no need for you to create an API.