Flex + Webservices

In this article, we will look into the following:

  1. How do I write code for handling data from a webservice.
  2. What attributes would I need to be familiar about to setup the connections.

Now that we know what to do, let’s get moving to the next. Before that, we need to know what things are needed to be ready in order to proceed. First, we need to have an already fully coded Webservice running on a website. In this example, we are using Localhost domain, or simply the development machine as the Webservice source. And the filename of that Webservice is called student.asmx.

For this article, we will not be covering the details of student.asmx, as it is another set of technology requiring another article, so we’ll just leave that for now, treat it like a blackbox and only send and receive data from it.

The Login User Interface

Let’s write a login panel for our students. To be validated as a student, a user has to present credential to the login webservice by simply entering the Login Name and Password. The UI panel collects them and sends them over the wire to the webservice. The Webservice receives the credential and checks to see if it is a valid credential. Once validated, it returns the student record to the client login panel.

In the figure above, a graphical representation of the login panel have two input boxes for entering login ID and password, followed by the login button. The user enters data to the input boxes and later presses the login button to send the data to the server.

At the source code level, the xml declaration counterpart is shown below. You’ll see in full detail the attributes of the elements like the panel, input boxes, buttons and labels. Notice the login button has an attribute named click with a value of saveData() which is a symbol for a function name for handling the click event.

The click event handler for the button is shown below, saveData() calls the send() method found in studentWS, a webservice that does all the work of sending the data to the webservice and receiving the data back from the webservice. In this case, studentWS is the webservice, while studentLogin is the function declared inside the webservice, send is a method foe initiating the event.

At this point, you have a pretty good idea of setting up a graphical panel and the corresponding xml declaration. You also now know how to setup the send() event and where to attach it, the click attribute of the button.

The Webservice Tag

About these ads

One Response to Flex + Webservices

  1. [...] Flex + Webservices « Freedom Culture In this article, we will look into the following: 1. How do I write code for handling data from a webservice. 2. What attributes would I need to be familiar about to setup the connections. (tags: flex flash webservices WebAppDevResources ISC) similar nonsense in: ill.icio.us |     No Comments » [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: