


Flex provides
This article uses WebService developed in C# language under the .NET platform as a remote data source to introduce in detail the data communication knowledge points between Flex and .NET's WebService; including connecting to WebService and remotely calling WebService methods , passing parameters and other related knowledge points to the WebService method. The usage of the three tags is basically the same. Here we take the
First take a look at the following code block:
1
3useProxy=" false">
4
5
6
wsdl attribute can be specified to the wsdl address of the WebService to be accessed, which defines two operation tags (
1///
2///return string
3///
4///
5[WebMethod]
6publicstringHelloWorld()
7{
8return"HelloWorld";
9}
10
11///
12///Return a simple object
13///
14///
15[WebMethod]
16publicBookGetBook()
17{
18returnnewBook
19{
20Id=1,
21Name="Romance of the Three Kingdoms",
22Author="Luo Guanzhong",
23Price=100
24};
25}
The above is the WebService method definition and passed in the Flex client (mxml) tag to access the complete process of WebService. Let’s take a look at how to call the methods defined by WebService on the Flex client:
1<script><br>23importmx.controls.Alert;<br>4importmx.rpc.events.FaultEvent;<br>5importmx.rpc.events.ResultEvent;<br>6<br>7/**<br>8* Initiate a request to WebService - call the HelloWorld method, dataService is the id of <webservice><br>9**/<br>10internalfunctiononRequest():void<br>11{ <br>12dataService.HelloWorld();<br>13}<br>14<br>15/**<br>16*Request result returned after successful processing<br>17**/<br>18internalfunctiononSuccess(evt:ResultEvent):void<br>19{<br>20Alert.show(evt.result.toString());<br>21 }<br>22<br>23<br>24/**<br>25*Handling function for request failure<br>26**/<br>27internalfunctiononFault(evt:FaultEvent):void<br>28{<br>29Alert.show("Failed to access WebService!");<br>30}<br>31]]><br> 32</webservice></script>
Through the above call, you can complete an interaction between Flex and .NET WebService. Of course, we can also pass parameters when calling WebService on the Flash/Flex client. The following WebMethod definition of WebService is as follows:
1///
2///will be passed in Convert the parameters to uppercase characters and return
3///
4///
5///
6[WebMethod]
7publicstringConvertToUpper(stringvalue)
8{
9returnvalue.ToUpper();
10}
You can access it by configuring
1
1 /* *
2*Initiate a request to WebService
3**/
4internalfunctiononRequest():void
5{
6//dataService.HelloWorld();
7dataService.ConvertToUpper("abcdefg");
8}
In addition, we can also pass
Go back to the front and take a look at the method definition of WebService. One of the methods, GetBook, returns a Book object. If it is the returned object, how do we get the value of this object on the Flex client? For details, see the following code example:
1internalfunctiononObject():void
2{
3dataService.GetBook();
4}
5
6internalfunctiononObjectSuccess(evt:ResultEvent):void
7{
8 //Get the return value directly through the event's result attribute, and then access the attribute directly to OK
9Alert.show(evt.result.Name);
10}
11
12/**
13*Handling function for request failure
14**/
15internalfunctiononFault(evt: FaultEvent):void
16{
17Alert.show("Access to WebService failed!");
18}

This article explains how to create newline characters in C using the \n escape sequence within printf and puts functions. It details the functionality and provides code examples demonstrating its use for line breaks in output.

This article explores the challenges of NULL pointer dereferences in C. It argues that the problem isn't NULL itself, but its misuse. The article details best practices for preventing dereferences, including pre-dereference checks, pointer initiali

This article guides beginners on choosing a C compiler. It argues that GCC, due to its ease of use, wide availability, and extensive resources, is best for beginners. However, it also compares GCC, Clang, MSVC, and TCC, highlighting their differenc

This article emphasizes the continued importance of NULL in modern C programming. Despite advancements, NULL remains crucial for explicit pointer management, preventing segmentation faults by marking the absence of a valid memory address. Best prac

This article reviews online C compilers for beginners, focusing on ease of use and debugging capabilities. OnlineGDB and Repl.it are highlighted for their user-friendly interfaces and helpful debugging tools. Other options like Programiz and Compil

This article discusses efficient code copying in C IDEs. It emphasizes that copying is an IDE function, not a compiler feature, and details strategies for improved efficiency, including using IDE selection tools, code folding, search/replace, templa

This article compares online C programming platforms, highlighting differences in features like debugging tools, IDE functionality, standard compliance, and memory/execution limits. It argues that the "best" platform depends on user needs,

This tutorial guides users through installing C compilers on Windows, macOS, and Linux. It details installation for popular compilers (MinGW, Visual Studio, Xcode, GCC), explains environment variable configuration, and offers troubleshooting steps


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
