7.5. Import Web Service (WSDL)

Flex Builder 3 has a built-in introspection wizard that reads the remote WSDL file and automatically creates the client-side code needed to invoke the web service. This wizard creates ActionsScript classes that will return typed objects that can be easily used within your application. If you are using Flex Builder 3, the WSDL Introspection wizard will certainly make it easier to use web services within your application. To demonstrate how to use the wizard, create a new AIR project named Chapter7_Introspection.

  1. To launch the wizard, select the Data menu and choose Import Web Service (WSDL) to launch the WSDL Introspection wizard (see Figure 7-12).

  2. Next, select a source folder, which will be the location where the new ActionScript classes will be generated, and click the Next button (see Figure 7-13).

    This sample will use the same stock quote web service that was previously used.

  3. Enter www.webservicex.net/stockquote.asmx?wsdl for the WSDL URI in the next step, which is shown in Figure 7-14.

  4. Click Next and you may see an error that says SOAP 1.1 is the only supported protocol. To remedy this, select StockQuoteSOAP from the Port dropdown menu. This is shown in Figure 7-15.

  5. Now click the Finish button, and the ActionScript classes will be generated.

Figure 7-16 shows the generated classes. To use this service, you now can simply create a new StockQuote object and call methods as you would any other object. The newly created classes will handle the call out ...

Get Beginning Adobe® AIR™: Building Applications for the Adobe Integrated Runtime now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.