Friday, July 13, 2012

Answer by OscarRyz for what is API web services, how do you create them and why?

Answer by OscarRyz for what is API web services, how do you create them and why?:
what is the purpose of web services?

Allow the easy consumption of a service using web technologies? I mean, you can potentially code your application to do what the browser does ( that's how many applications for stackoverflow have been done in the past )

The problems are:

it is much harder than using an API

Since there is no API, changes in the website do crash your application ( while responsible API's will allow you to use your old version )

i mean isn't all web applications a web service ?

Not at all. A web app is an specific application designed to be used by a webbrowser ( firefox, chrome, etc ) While a webservice is meant to be consumed by other application.

You can consume a webservice in pretty much any programming language out there.

also why do people create API web services? is it to let developer's use the website's functions? kinda like facebook and youtube ?

Not the website functionality but to allow them to create own applications that use some functionality of that website.

For instance YouTube allow you to upload videos with it's API, otherwise you'll have to "simultate" the HTTP post which can be problematic.

That way, some tools offer the capability of "uploading" your video directly from the app.

is it possible to make a API for web service where you can use C++ or VB to use the functions?

That's the point, among other programming languages.

therefore, someone could make a desktop application based on your web application's API ?

Exactly!!!

Here's an example of the Object-C application I use for Twitter ( tweetie )

alt text

how do you create a web service API and a web service ?*

It is not much different from creating a API for an internal fremework/product/library.

You have to define what are you going to offer ( your public interface, your services that is )

Create a list of in/out parameters and interchange formats ( XML, json, text/plain, YAML, whatever )

And finally provide and endpoint in the web ( or why not intranet )

Webservices could are harder to control than regular APIs, you have to check security concerns, work load etc.

To see a working API refer to that mentioned by Nathan here

 --------------------------------------------------------------------------------------------


We all talk about webservices, webservices can do this and webservices can do that. But when we are asked to make one, we hesitate. Maybe it's because we never made a webservice before, and all the time playing with Webforms and Windows Forms or even Console Applications. By the way, I love Console applications. In this article, I will show you how to create a simple webservice that is consumed by a Console application client.


First, start your Visual Studio .NET, and in the project type, select ASP.NET WebService. In the left pane, choose the language of your choice. In this example, I will be using Visual C#.NET. Once you select the project, a page will appear which will be more like a design page, switch to its code view. In the code view, you can see lot of comments and C# code already written for you. You will also see that at the bottom, there is a method HelloWorld which is written for you by default, so you can test your service and of course say hello to the world. After removing the unwanted code and comments, your code will look like this:


http://www.codeproject.com/Articles/8257/How-to-make-a-simple-WebService-and-consume-it

No comments:

Post a Comment