Why Use Web Services?


Some time ago, I was working on a sales force application that managed all the retail outlets for a client's sales force. I made all the Flash pieces and the objects necessary for it to work, but when I started testing it with live data, it wouldn't return all the correct information. I looked through the database itself at the point where it was getting hung up, and lo and behold, there was an ampersand in not only one, but a few of the store names. Remember back in Chapter 20, "Introduction to Data Integration," where you were introduced to data integration with Flash? You learned that name/value pairs are separated by ampersands. This means that when the parser reached the store name with the ampersand, it would think that part of the name was data, and the other part was the beginning of the next name/value pair, like this:

The original store name: A&B Grocery

Was thought to be: name=A&B Grocery=. You can see how frustrated I was after checking everything else first.

This is a very common problem for developers working with middleware, having to check individual data pieces to make sure each one fits exactly. And then you have to make sure the data cannot be put back in with an ampersand so that the problem won't happen again. Even worse, what if I can't see the data and the middleware page? I would be stuck with no idea of what is causing the strange error with my data.

This is where web services really fit in. Because web services send back XML data, all I have to do is create a parser to parse XML, and then it does not matter what data is coming back because the XML has self-describing tags.

Web services can be written in several languages, but in this chapter, we will use ASP.NET. Each web service written will have a WSDL (Web Services Description Language) file that will describe our web service to anyone who intends to use it. More on that later in this chapter.

To use .NET you must have a personal web server (or a web server on the web with .NET installed) and you must install .NET. You can get .NET from this link:

http://www.microsoft.com/downloads/details.aspx?familyid=9B3A2CA6-3647-4070-9F41-A333C6B9181D&displaylang=en

Not all examples will require you to have .NET or a personal web server installed, but to re-create some of the web services from this chapter, you will need it.




Macromedia Flash Professional 8 Unleashed
Macromedia Flash Professional 8 Unleashed
ISBN: 0672327619
EAN: 2147483647
Year: 2005
Pages: 319

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net