|< Day Day Up >|
The large players involved in Web Services include Microsoft, IBM, and SUN. They have all agreed to uphold certain conventions when using Web Services. The two key standards are WSDL and SOAP. In addition, UDDI provides a marketplace for all Web Services, which enables developers to easily find the appropriate Web Services. These standards are the key to creating cross-platform, XML-compliant Web Services.
WSDL is language designed to describe the content of Web Services. A WSDL file is simply an XML file that is very similar to a data schema in Macromedia Flash MX 2004 Professional. The WSDL language description lists all the server-side methods that can be called; it also lists the parameters that must be passed to the server-side method. For example, the stock service WSDL shown in Figure 13.1 is expecting a company symbol (such as MACR or AAPL) to be passed to it, and this is indicated in the WSDL file. The WSDL file also describes the type of data that will be returned; this is known as the results of the web service. The WSDL also gives a description of what the web service does and its location.
Figure 13.1. A raw WSDL file can be difficult to read and understand.
Figure 13.1 shows a raw WSDL file viewed in a browser; as you can see, it is not exactly very easy to read and understand. For more information on WSDL, you can find the full specification at www.w3.org/TR/wsdl.
Flash MX 2004 Professional has a new Web Services panel that takes the URL of any WSDL and translates it into plain English. The Web Services panel, for example, shows us exactly the method names of the stock services website and what parameters it requires. From the Web Services panel, we can see that only one parameter, a string, needs to be passed to the server-side method, and we can see that an array of objects will be returned from the web service. All we need to do to use the panel is to enter the URL of the WSDL in the Web Services panel. The Web Services panel makes learning about and using WSDL files easy.
Figure 13.2. The Web Services panel translates a raw WSDL file into plain English that can be understood .
SOAP is the protocol used to send information between applications through Web Services. It is the envelope that encapsulates the messaging to and from the Flash client and a web service. SOAP works in conjunction with WSDL. The data that is sent by means of SOAP is just raw textual data in an XML format, which is in contrast to other protocols that send information in a binary format. Protocols that use a binary format tend to consume less bandwidth because the data that is being sent is more compressed.
Macromedia has a propriety protocol that is used exclusively with Flash Remoting. It is known as ActionScript Messaging Format (AMF). The AMF format consumes much less bandwidth than SOAP because it is binary. The advantage of using Web Services and SOAP over AMF is that SOAP is a standard, it is not proprietary, and it is widely available across the Internet.
The SOAP protocol contains the name of the server-side object and method to be called. SOAP also contains the XML packets that contain the parameters to be passed to the server-side method. This information is all encapsulated within a SOAP envelope, as shown in the following code:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope"> <soap:Body> <!actual SOAP XML content here > </soap:Body> </soap:Envelope>
The important fact to remember is that SOAP content is just XML data in a textual form with which we are used to dealing. The Web Services classes in Flash MX 2004 will automatically convert this XML data into useable data structures for ActionScript 2.0.
The SOAP protocol, like the AMF protocol, is specifically designed to work over the Hypertext Transfer Protocol (HTTP), which, of course, is an Internet standard. This is a big advantage that AMF and SOAP have over other protocols that do not work with web standards and all platforms.
SOAP has a big advantage over other protocols, such as the Component Object Model (COM) and CORBA, because it is platform independent and works with web standards. When we work with SOAP in Flash, all the complexity of the protocol is hidden from us and handled by the built-in Web Services classes.
A third standard that helps make Web Services possible is UDDI, which is simply a directory of available Web Services. It gives developers a place to market the Web Services that have been created. It also gives customers, or consumers of Web Services, a place to search for Web Services that might meet their needs. A web service consumer can generate a query at these sites, and a list of available Web Services will be returned.
A number of UDDIs are maintained on the Internet; two of the largest public ones are run by Microsoft and IBM and are available at:
|< Day Day Up >|