[Flex] creating WebService calling through as (ActionScript)

Source: Internet
Author: User

Before writing Flex applicaton Always get used Mxml To describe WebService And then call it. The disadvantage is that WebService Too scattered descriptions are not conducive to maintenance (if you need WebService Add Soapheader Even if it is not a nightmare, It is a headache ). For convenienceCodeMaintenance, so I wantProgramAll Web Interface Encapsulate Class . Web Interface You can modify the related information during modification and maintenance. Class , Which greatly improves Web Interface .

However, in the implementation process As Create WebService And cannot be called effectively. After N No results have been found in the attempt and search for the relevant information. Flex (Because of WebService All created through Mxml ). I believe that there will always be results, and I have no intention of finding Flex Of Blog Discover bloggers Flex For more in-depth research, I leave a message asking questions. Although there is no clear answer, he told me to modify the compilation parameters to see the relevant Applicaton Generated As Code. In this way, you can see Flex If you set Mxml The description mark generates the corresponding As Code.

I thought this time the problem could be solved quickly, but the real thing was a blow. Flex Automatic Generation WebService Copy the code to my Application Or the call is invalid. It was not worth trying to give up but to get back. After all, it took about a day to get in. It would be worth nothing! Therefore, analysis Flex What is the difference between the compiled code and your own code. After several attempts, the call was successful, but the method of calling the code is very confusing! To verify this obscure call method, you can only modify the code for debugging several times to call the code normally.

1) must be in the initialize event instantiation WebService object; the call is invalid if it is instantiated elsewhere or before use!

2 ) instantiate WebService after an object, you must call the initiali Zed method.

although the problem has been solved, I still cannot understand the solution; after all, this processing method is hard to understand. If you use as Create a call WebService Please let us know if you have other methods, I am very grateful to you for your support.

Custom rule code:
Public class employeelogic extends WebService
{
VaR MADD: MX. rpc. Soap. operation;
Public Function employeelogic ()
{
Super ();
Super. WSDL = "http: // localhost/webservice3/service1.asmx? WSDL ";
Madd = new operation (this, "add ");
Madd. resultformat = "object ";
Madd. Request = {items :{}};
Madd.tar getnamespace = "http://tempuri.org /";




}

}

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.