A quick note about .NET Web Services, Adobe Flex and Namespaces
I was building out some .NET based web services for a Flex project I’ve been working on and bumped up against something that gave me a bit of trouble. When you create a .NET Web Service there is a namespace attribute associated with the service. Here’s an example (in c#) :
namespace HelloWebService
{
[WebService(Namespace = "http://www.examplenamespace.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]public class Service1 : System.Web.Services.WebService
{// implementation …
}
This value is required by .NET for a web service, or at the very least .NET gets VERY upset if this value is not set.
You will then need to let Flex know about this namespace in order to access the results. To do this you simply add the following lines to Flex:
private namespace lh = “http://www.examplenamespace.com/”;
use namespace lh;
Not much to it, but it can be a bit of a pain when you’re not aware of this. Flex doesn’t complain, it just gives you empty values when you try to access the values.