Adobe
製品
Acrobat
Creative Cloud
Creative Suite
Digital Marketing Suite
Digital Publishing Suite
Elements
Photoshop
Touch Apps
その他の製品一覧
ソリューション
デジタルマーケティング
デジタルメディア
教育
金融機関
Web Experience Management
その他のソリューション
ラーニング サポート ダウンロード 会社情報
ご購入
アドビストア 安心のサポート& サービス
アカデミックストア 学生、教職員、個人向け
アドビライセンスストア 中小企業向け
ボリュームライセンスについて 企業、教育機関、官公庁向け
販売パートナー
キャンペーン情報
検索
 
情報 サインイン
ようこそ、 さん カート 注文状況 マイアカウント
マイアカウント
注文状況
アカウント情報の変更
コミュニケーションの設定を変更
サインアウト
サインインの目的 お客様のアカウントや体験版ダウンロード、製品の拡張機能、コミュニティエリアへのアクセスなどを管理するため
Adobe
製品 セクション ご購入   検索  
ソリューション 会社情報
サポート ラーニング
サインイン サインアウト 注文状況 マイアカウント
先行予約の提供開始予定日Date. 商品が発送されるまで、クレジットカードには課金されません。提供開始の予定日は変更される場合があります。 先行予約の提供開始予定日Date. ダウンロードの準備が整うまで、クレジットカードには課金されません。提供開始の予定日は変更される場合があります。
個数:
ご購入には学生・教職員個人版の購入資格の確認が必要です。
小計
カートの中身を見る
Adobe Developer Connection / Flexデベロッパーセンター /

Building web service clients with Flex Builder 3

著者 Zee Yang

Zee Yang
  • www.flexlive.net/

Created

14 July 2008

ページ ツール

Facebookでシェア
Twitterでツイート
LinkedInでシェア
ブックマーク
印刷

タグ

Requirements

Prerequisites

Working knowledge of SOAP messaging and ActionScript 3.0.

User Level

中級

必要な製品

  • 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
  • Flex 3とILog Elixirを使用した簡単なダッシュボードの作成
  • Using web services with Data Centric Development in Flash Builder 4 beta

製品

  • Acrobat
  • Creative Cloud
  • Creative Suite
  • Digital Marketing Suite
  • Digital Publishing Suite
  • Elements
  • モバイルアプリ
  • Photoshop
  • Touch Apps

ソリューション

  • デジタルマーケティング
  • コンテンツオーサリング
  • Web Experience Management

業種別ソリューション

  • 教育
  • 金融機関

サポート

  • ヘルプ&サポート
  • 注文と返品
  • ダウンロードに関するヘルプ
  • ユーザー登録に関するヘルプ

ラーニング

  • ADC: Adobe Developer Center
  • Adobe TV
  • Design Magazine
  • Photoshop Magazine
  • Focus In

ご購入方法

  • アドビストア
  • アカデミックストア
  • アドビライセンスストア
  • ボリュームライセンスについて
  • 販売パートナー
  • キャンペーン情報

ダウンロード

  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player

会社情報

  • プレスルーム
  • パートナープログラム
  • 企業の社会的責任(英語)
  • 採用情報
  • 投資家の皆様へ(英語)
  • イベント&セミナー
  • Legal(英語)
  • セキュリティ
  • お問い合わせ
国・地域および言語の選択 日本(変更)
国・地域および言語の選択 閉じる

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 © 2012 Adobe Systems Incorporated. All rights reserved.

利用条件 | プライバシーポリシーとCookie (更新)

Reviewed by TRUSTe: site privacy statement