Wednesday, March 21, 2007

Assignment #9

After playing around with Yahoo Pipes for a while, I realized that there is a lot of power behind such a simple idea. Create one web page that has the power to search for anything. Using these pipes you can gather a lot of information from multiple sources, from a centralized location. At first I found Yahoo Pipes to be a bit confusing. While I understood what was being done, I had a problem creating my own working Pipe. After searching and studying previously created Pipes, I finally grasped enough of how they worked to make my own. The pipe I created, which can be found at This Page brings together Flickr and Google to do a variety of different searches.

With the introduction of Web 2.0 the world is able to upload and share information with everyone in the world. Instead of companies and other web sites telling us what to look at, we are able to upload our own information and create our own websites. Yahoo Pipes is helping us gather information from different blogs and other various Web 2.0 sites, along with non Web 2.0 sites. The user will type in what he/she wants to search for, and the search looks for all items that have been tagged with the same information.

AJAX is somewhat the same, yet different at the same time. AJAX, or Asynchronous JavaScript, is used to help create interactive web pages. Instead of reloading whole web pages, AJAX exchanges small bits of information with the server, behind the scenes, which gives web pages much faster load time. This also gives the creator/user a much more enjoyable time, as they don’t have to constantly wait for their information to stay updated.

So, how does Yahoo Pipes incorporate both of these new ways of thinking? Well, after you have created your Pipes, you can publish it and let the world see and use your newest creation. This satisfies the Web 2.0 portion, so how does AJAX fit in? Yahoo has made creating various Pipes very easy. You simply drag and drop different pieces and connect the pieces with pipes. This method of construction is using AJAX. You are adding new content to the web page constantly, but the whole page doesn’t keep reloading. That is because each time you move part of your design, small amounts of information is sent to the server, updating your page to work seamlessly.

This fits in nicely with our conversations about Service Oriented Architecture as it is very user friendly, and will work for anyone who can run the Internet. There is no special program that needs to be installed on your machine to have this work, which in turn, benefits the most people.

It is amazing how we use this technology every day, but most people don’t understand a thing about it. As long as it works, people are happy. Really though, if it wasn’t for Web 2.0 and AJAX being implemented in this project, it wouldn’t have quite the same effect on as many people as it is.

Thursday, March 8, 2007

Assignment #8

The Difference between REST and SOAP Web Services

There are many differences between REST and SOAP Services. First off, SOAP uses envelopes combined with the HTTP POST request. REST communicates directly with the URL using a HTTP GET request. This should make the whole communication process go a little quicker. It is also common for SOAP vendors to route all their HTTP POST requests through one URL. This is now creating a place for a bottleneck, depending on how much traffic there is at any given time. One feature that REST uses is the ability to use specific URL’s to get detailed information on different searches, whereas SOAP doesn’t use links at all. This ability is what sites like Amazon.com uses to give detailed information about their products to their customers or potential customers. SOAP users are forced to find the information elsewhere, which would be a headache to most online shoppers.

REST, like SOAP can also be used with Proxy Servers. The difference between the two is how this is implemented. Using REST, the request is made, but the proxy server recognizes that it is not allowed, thus not fulfilling the request. SOAP on the other hand doesn’t use specific URL’s so the Proxy Server is unsure what to do with the request. Therefore, companies that want to restrict certain areas of the Internet would use the REST/Proxy Server combination to keep their employees in check.

REST also speeds up requests by caching information more quickly. As the request is being processed, it is determined if it is cacheable. If it is, servers will make a local copy, thus speeding up the whole process for the user. SOAP servers do not know what is being requested buy the user, so there is no caching possible using SOAP.

All in all, with REST using URL’s to keep track of information and to help use the user delve deeper into their search of interest, it seems to be a better option to use in most cases.


Exploring RESTful API

I wanted to find a website that I was familiar with when searching for this RESTful API question. I figured that way I might be able to understand what I was reading about better. I chose the website www.facebook.com. Facebook is networking website that started off only allowing people with designated .edu email addresses. It has since opened its doors to let anyone in, acting along the same lines as Myspace. Within this vast website there are many different commands or methods that must be followed.

Starting off, the user has to enter their username and password which will create a token which will be checked certain records. There could also be a number of error messages that could be displayed if there is an error. Facebook will then take the user to a designated URL, which is a feature of REST. After the token is created, a getsession command is started which will return the session key that was created after the user signed in.

Facebook also has the ability to show people who your friends are. It does this using an array which compares to profiles and determines if each of them has each other as a friend. A list of friend_info is then returned if the situation is true. A big feature of Facebook is the ability to create a photo album for your friends to view. This is done by calling the Facebook API photos.createAlbum, photos.upload, and photos.addTag. The pictures are then able to be tagged, using the photos.addTag, which creates boxes over individual faces. These boxes are then linked to that persons specific URL of their Facebook profile. if they have one.

The API of Facebook makes it very easy to call these functions. You simply click and type your way to whatever meets you desire. Luckily for us, each command that is requested of Facebook is translated into meaningful information for the computers. We simply fill in text boxes and forms.

One nice feature that Facebook offers is the ability to use their API Test Console. If you have an account, you can call all of their methods, and it will give you the output code from each method. It doesn’t just give you generic code either. It will allow you to see the code that it would actually use when calling information from your account. That way you can see specifically how it works.

While this website doesn’t serve a purpose to everyone who has access to the web, it serves a great purpose to many college students. This program allows people to get in touch with old friends, stay in touch with current friends, and view other people’s profiles who are in the same network. This is just one of the many online communities that have become popular in the past years. REST is important to Facebook because as you are searching for your lost friend, it must have the ability direct you to specific URL’s as necessary, something SOAP is incapable of doing.

Reference:

http://developers.facebook.com/documentation.php

Thursday, March 1, 2007

Assignment #7

1. The line is telling us that it is using Cocoon, while using a component called XmlHttpTransformer.
The next lines are defining the action that is requested which are a stock quotes.
The following lines are the body of the code which is a soap request. It is calling the methods-delayed-quotes SOAP method to get the quote for IBM. This will be in string format.
The next lines are defining yet another method which will be currency exchange.
The exchange rates for the United States and Japan are required for this, which are also strings.
All of this code is the request of the information.

2. Once again it is telling us that we are using Cocoon while using a component called XmlHttpTransformer.
This time though, we are calling for the information that number 1 requested.
The result, which is now calling for a float command, is 82.92 in US currency.
After using the Japan exchange rate, we see that the stock is worth 122.52

3.1 WSDL uses the following elements:
Types – a container for data type definitions using some type system (such as XSD).
Message – an abstract, typed definition of the data being communicated.
Operation – an abstract description of an action supported by the service.
Port Type – an abstract set of operations supported by one or more endpoints.
Binding – a concrete protocol and data format specification for a particular port type.
Port – a single endpoint defined as a combination of a binding and a network address.
Service – a collection of related endpoints.

3.2 The code for a soap request and response is almost identical according to this article. The only difference is the middle lines. In the request, we see that it is requesting the lasttradeprice for the stock matching DIS. In the response, we are asking for the result which was 34.5.

3.3 A port type is a named set of abstract operations and the abstract messages involved. It is also one of the elements that WSDL uses.

3.4 An error message or status information for SOAP message is contained within a fault element.

3.5 MIME Binding is used to bind different types of data together. The following are defined:
multipart/related
text/xml
application/x-www-form-urlencoded (the format used to submit a form in HTML)
Others (by specifying the MIME type string)

4. #!perl -w
use SOAP::Transport::HTTP;
SOAP::Transport::HTTP::CGI

-> dispatch_to('Calculator')

-> handle;


package Calculator;


sub add {

my ($class, $a, $b) = @_;

return $a+$b;

}


sub subtract {

my ($class, $a, $b) = @_;

return $a-$b;

}


sub multiply {

my ($class, $a, $b) = @_;

return $a*$b;

}


sub divide {

my ($class, $a, $b) = @_;

return $a/$b;

}