Adobe
Products

Top destinations

  • Adobe Creative Cloud
  • Creative Suite 6
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst
  • Students
  • Elements family

Adobe Creative Cloud

  • What is Adobe Creative Cloud?
  • Design
  • Web
  • Photography
  • Video
  • Students
  • Teams
  • Enterprise
  • Educational institutions
  • Government

Design and photography

  • Photoshop
  • Illustrator
  • InDesign
  • Adobe Muse
  • Lightroom

Video

  • Adobe Premiere
  • After Effects

Web development and HTML5

  • Edge Tools & Services [opens in a new window]
  • Dreamweaver
  • Gaming [opens in a new window]

Adobe Marketing Cloud

  • What is Adobe Marketing Cloud?
  • Digital analytics
  • Social marketing
  • Web experience management
  • Testing and targeting
  • Media optimization

Analytics

  • SiteCatalyst
  • Adobe Discover
  • Insight

Social

  • Adobe Social

Experience Manager

  • CQ
  • Scene7

Target

  • Test&Target
  • Recommendations
  • Search&Promote

Media Optimizer

  • AdLens
  • AudienceManager
  • AudienceResearch

Document services

  • Acrobat
  • EchoSign [opens in a new window]
  • FormsCentral [opens in a new window]
  • SendNow [opens in a new window]
  • Acrobat.com [opens in a new window]

Publishing

  • Digital Publishing Suite

  • See all products
Business solutions

By business need

  • Digital analytics
  • Digital publishing
  • Document management
  • Media optimization
  • Social marketing
  • Testing and targeting
  • Video editing and serving
  • Web development [opens in a new window]
  • Web experience management
  • See all business needs

By industry

  • Broadcast
  • Education
  • Financial services
  • Government
  • Publishing
  • Retail
  • See all industries
Support & Learning

I need help

  • Products
  • Adobe Creative Cloud
  • Adobe Marketing Cloud
  • Forums [opens in a new window]

I want to learn

  • Training and tutorials
  • Certification [opens in a new window]
  • Adobe Developer Connection
  • Adobe Design Center
  • Adobe TV [opens in a new window]
  • Adobe Marketing Center
  • Adobe Labs [opens in a new window]
Download
  • Product trials
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • See all downloads
Company
  • Careers at Adobe
  • Investor Relations
  • Newsroom
  • Privacy
  • Corporate Social Responsibility
  • Customer Showcase
  • Contact us
  • More company info
Buy
  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers
  • Adobe Marketing Cloud sales [opens in a new window]
Search
 
Info Sign in
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Welcome,
My Adobe
My orders
My information
My preferences
My products and services
Sign out
My cart
Privacy My Adobe
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out Privacy My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Promotions
Estimated shipping
Tax
Calculated at checkout
Total
Review and Checkout
Adobe Developer Connection / Flex Developer Center /

Building web service clients with Flex Builder 3

by Zee Yang

Zee Yang
  • www.flexlive.net/

Created

14 July 2008

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
FlexSOAPweb services
Was this helpful?
Yes   No

By clicking Submit, you accept the Adobe Terms of Use.

 
Thanks for your feedback.

Requirements

Prerequisites

Working knowledge of SOAP messaging and ActionScript 3.0.

User Level

Intermediate

Required products

  • Flex Builder 3 (Download trial)

Sample files

  • hellows.zip (24 KB)

Web service standards are an important cornerstone of enterprise SOA. While the Flex platform has always had native support for web services, Flex Builder 3 has taken it one step further with a new feature, Web Service Introspection.

Using a modified version of Apache Axis framework, the new Web Service Introspection wizard generates proxy classes that take care of web service data transfer and event plumbing. With this new tool, an application developer can build a web-service–enabled Flex client in minutes!

This article shows how to use the Web Service Introspection Tool, and explains the code it generates for a sample application.

Using the Web Service Introspect wizard

After opening a Flex project in Flex Builder, choose Data > Import Web Service. The wizard will ask for the WSDL URI and a path to save the generated code (see Figure 1). The Web Services Description Language (WSDL) document contains information that a client needs to use the web service.

The Web Service Introspection wizard
Figure 1. The Web Service Introspection wizard

After inspecting the WSDL file, the wizard presents code generation options (see Figure 2). You can select which web service operations to target, and specify the fully qualified name for the ActionScript class.

Code generation options
Figure 2. Code generation options

You can choose Data > Manage Web Services to access the Manage Web Services dialog box, which is useful for updating and deleting WSDL information, as well as managing multiple web services associated with a project (see Figure 3).

The Manage Web Services dialog box
Figure 3. The Manage Web Services dialog box

Understanding the generated Code

Depending on the complexity of the WSDL, there can be an almost overwhelming number of classes generated. The actual mechanics of the generated classes is quite simple, however.

First, look at the class in the <Service Name>.as file (in the example shown in Figure 2, this would be USWeather.as). It's the proxy class that you use to drive the web service calls. Note that the WebService class is no longer used in Flex. All the service calls are made through <Service Name>.as.

In addition, all the web service members are listed in <Service Name>.as as public functions. There are two ways you can invoke a service call:

  • Attach an event handler to a service call. If you come from a Java/.NET background, this is would be the most intuitive approach. After instantiating the main service class, attach an event handler to the service call and proceed to invoke the service call. For example:
private var weather:USWeather = new USWeather(); private function getMyWeather1():void { // Attach the event handler weather.addgetWeatherReportEventListener(handleWeather); // Invoke the service call weather.getWeatherReport("37217"); } private function handleWeather(event:GetWeatherReportResultEvent):void { trace(event.result); }
  • Bind to the last result. This approach leverages the Flex data binding feature and simplifies your code. To make a service call, pass the parameters via <method>_Request_var and invoke <method>_send. The return data will be stored in <method>_lastResult. For example:
[Bindable] private var weather:USWeather = new USWeather(); private function getMyWeather2():void { // Set the input parameter var req:GetWeatherReport_request = new GetWeatherReport_request(); req.ZipCode = "37217"; weather.getWeatherReport_request_var = req; // Invoke the method weather.getWeatherReport_send(); }

All data exchange is done via strongly typed data structures. For example, if you were making a call to getCustomer, which returns a CutomerInfo object, the object type would be defined by the CutomerInfoType class.

Some web service endpoints require basic authentication. To set the credentials, use the setCredentials(), setRemoteCredentials(), and logout()functions from the base class, Base<Service Name>.as.

Where to go from here

The new Web Service Introspection wizard has made developing SOAP clients effortless in Flex. The strongly typed message passing not only gives you a water-tight communication pipe, but it also makes coding much easier in the IDE.

One drawback of using web services is the communication overhead. If your Flex application handles large amount of data, consider using the BlazeDS Remote Object Service instead.

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License

More Like This

  • Creating a rich buying experience with a data-driven RIA
  • Building a simple dashboard using Flex 3 with ILOG Elixir
  • Using web services with Data Centric Development in Flash Builder 4 beta

Tutorials & Samples

Tutorials

  • Flex mobile performance checklist
  • Flex and Maven with Flexmojos – Part 3: Journeyman
  • Migrating Flex 3 applications to Flex 4.5 – Part 4

Samples

  • Twitter Trends
  • Flex 4.5 reference applications
  • Mobile Trader Flex app on Android Market

Products

  • Adobe Creative Cloud
  • Creative Suite 6
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elements family
  • SiteCatalyst
  • For education

Download

  • Product trials
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

Support & Learning

  • Product help
  • Forums

Buy

  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2013 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy (Updated) | Cookies

Ad Choices