Flex connection to WebService-(1)

Source: Internet
Author: User

After configuring flex a few days ago, I will start to use it. I will refer to the example in flex samples to create a flex connection to the weather forecast service. Program I started to work in flex1.5, and the results always showed that the WebService could not be connected. I asked the netizen dannyr, and he said that I would modify the flex configuration file in the website directory. Flex-config.xml , In <Whitelist> attribute of <web-service-proxy> Add the WebService URL. I have read the instructions in the following file:
For security, the whitelist is locked down by default.
Uncomment the first two URLs below to enable access to all URLs,
Or the last two URLs to enable access to the local server,
Or add abve the individual URLs you wish to access.
<URL> http: // * </URL>
<URL> https: // * </URL>
<URL> http: // {localserver}/* </URL>
<URL> https: // {localserver}/* </URL>
So I added http: // * to <URL> </URL>.
If the result is run again, the WebService cannot be connected. I try againCode Copy to flex2.0 and modify the syntax changes. The result flex2.0 can be connected to WebService. I don't know why.
When I got home on Saturday, I carefully searched for the cause. The original flex WebService component had a userproxy attribute. In 1.5, I set this attribute to false to connect to WebService. This attribute is not found in flexbuilder's smart perception. It really kills us beginners.
I connected the weather forecast WebService, but the data returned by it is not in XML format, and I have not figured out how to use it yet. So here I made a program to connect to the RSS reading service, this WebService returns the parsed HTML code through the given RSS connection.
The code for this flex program is as follows:

<? XML version = "1.0" encoding = "UTF-8" ?>
< MX: Application Xmlns: MX = "Http://www.macromedia.com/2003/mxml" >
< MX: WebService ID = "Rssservice" Useproxy = "False"
WSDL = "Http://www.webservicex.net/RssToHTML.asmx? WSDL"
Fault = "Alert (event. fault. faultstring )" Showbusycursor = "True" >
< MX: Operation Name = "Gethtml" >
< MX: Request >
< Rssurl > {Tirss. Text} </ Rssurl >
</ MX: Request >
</ MX: Operation >
</ MX: WebService >
< MX: Panel Width = "500" Height = "500" Cornerradius = "8" Panelborderstyle = "Roundcorners" >
< MX: vbox Horizontalalign = "Center" Width = "100%" >
< MX: hbox >
< MX: Label Text = "Rss url :" Width = "50"   />
< MX: textinput ID = "Tirss" Width = "300" Tooltip = "Enter the RSS connection address here" Text = "Http://bg5sbk.cnblogs.com/Rss.aspx"   />
< MX: button Click = "Rssservice. gethtml. Send ()" Label = "Get" Width = "50"   />
</ MX: hbox >
< MX: textarea Text = "{Rssservice. gethtml. Result }" Width = "400" Height = "400" Cornerradius = "10"   />
</ MX: vbox >
</ MX: Panel >
</ MX: Application >

Generated flash:

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.