Search Flex Components Free

Custom Search

December 17, 2007 c# webservice consumed by flex

Someone on the flexcoders asked to be provided with a simple example of flex consuming an webservice. I know this might be VERY simple, but it proves functionality.

ASP.NET Webservice in C#

using System;using System.Collections;using System.ComponentModel;using System.Data;using System.Diagnostics;using System.Web;using System.Web.Services;namespace Director{ public class Hello : System.Web.Services.WebService { public Hello() { InitializeComponent(); } #region Component Designer generated code private IContainer components = null; private void InitializeComponent() { } protected override void Dispose( bool disposing ) { if(disposing && components != null) { components.Dispose(); } base.Dispose(disposing); } #endregion [WebMethod] public string HelloWorld(string variable) { return "Hello " + variable; } }}
Flex Application:

If you're accessing a webservice on another machine or domain, don't forget the crossdomain.xml file in the IIS root:

Related Flex Tutorials