How Flex calls WebService

Source: Internet
Author: User
Tags event listener soap wsdl

Flex is not directly accessible to the database, so it can be used as a service to call the data, Httpservice, webservices is more commonly used two methods, because the contact WebService more so give its calling method.

import Mx.controls.alert;import Mx.events.flexevent;import Mx.rpc.events.ResultEvent; Import mx.rpc.events.FaultEvent; Import mx.rpc.soap.LoadEvent; Import Mx.rpc.soap.WebService; Import Mx.controls.Alert; private var str:string = "http://localhost/RaySky/Dvag.asmx?wsdl"; private Var Webservice:webservice;     Private Function OnClick (): void {//Create and instantiate the WebService sample, but first import webService class WebService = new WebService ();     webservice.wsdl = str;     WEBSERVICE.LOADWSDL (str);     Event Listener Webservice.addeventlistener (Loadevent.load, onLoad);     Webservice.addeventlistener (Resultevent.result, Onresult); Webservice.addeventlistener (Faultevent.fault, Onfault); } Private Function OnLoad (e:loadevent): void {//For related actions} Private function Onresult (e:resultevent): void {} private Fu     Nction Onfault (e:faultevent): void {trace (e.message); Give warning, lazy reluctant to debug the time so come Mx.controls.Alert.show ("Failed to connect to WebService, please check the network!") "," error "); }


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.