473,413 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Problem with consuming a .NET web service from Flex-ActionScript

Hi I am new to Flex and I use Flex Builder 2 to make a web service client. So I have a web service in .NET(c#) with a simple web method that returns a string(no arguments). It works, I tested it using firefox. I have managed to consume the service in Flex by using MXML like this:

<mx:WebService id="wsTestWebService" wsdl="http://localhost:3521/AjaxControlToolkitWebSite2/TestFlexService.asmx?wsdl"showBusyCursor="true" load="wsTestWebService.getGameUsers()">
</mx:WebService>

and then in a text control I do this:

<mx:Text x="107.5" y="534" width="243" id="text1" height="22" text="{wsTestWebService.getGameUsers.lastResult}"/>

Now my first question is this: How can I access the string that the wsTestWebService returns by actionscript? It seems that if I try to write

text1.text = wsTestWebService.getGameUsers.lastResult;

in a .as source file, I get nothing.

The thing is that I want to do everything by using actionscript so I tried that:
I placed a button in my project and a click event handler for that. The code is this:

private var isLoaded:Boolean = false;
private var hasResult:Boolean = false;

private function OnClick():void
{
var ws:WebService = new WebService();
ws.wsdl = "http://localhost:3521/AjaxControlToolkitWebSite2/TestFlexService.asmx?wsdl";
ws.addEventListener(LoadEvent.LOAD, load_listener);
ws.addEventListener(ResultEvent.RESULT, result_listener);
ws.loadWSDL();
var strXML:String;
if(isLoaded)
{
ws.getGameUsers.send();
}

if(hasResult)
{
text1.text = ws.getGameUsers.lastResult;
}
}



private function load_listener(event:LoadEvent):void
{
isLoaded = true;
}


private function result_listener(event:ResultEvent):void
{
hasResult = true;
}



Nothing happens. So what's wrong with this anyway? I have problems in understanding how to use the WebService class in actionscript but that's the way I want to do it anyway, not by MXML. Thanks in advance.
Sep 19 '07 #1
0 2861

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Tom Heathcote | last post by:
Apologies for posting a flex++ question rather than a C++ question, but there does not appear to be a flex++ newsgroup... I am trying to rebuild some old lexical scanner / analyzer code, which I...
0
by: Sparky | last post by:
Hi, I am trying to use a typed dataset with a web service and am having problems with type casting errors. I have a typed dataset which is in both my web service and my consuming application....
1
by: leslie_tighe | last post by:
Hello, I have webservice created with Axis 1.2.1 and that I am trying to consuming in .NET (VB) using the Microsoft provided tools. While I am able to consume methods on the service that return...
0
by: ryan | last post by:
I've been tasked with consuming a Perl web service that was written by a person in a different department of my company. The problem is it's the guy's first attempt at web services and he doesn't...
2
by: s | last post by:
'project with web service <webmethod()> _ public function myws(id as integer) 'do db stuff with id and build document Dim xd As New XmlDataDocument...
0
by: plmanikandan | last post by:
I need to develop a application to consume a webservice. For consuming web service i tried a example in Consuming a Web Service in C# in http://www.csharphelp.com.But i am uanble to use that...
1
by: Mahesh Devjibhai Dhola | last post by:
Hi, Scenario: The webservice was developed on windows 2000 Pro and deployed previously on windows XP pro for testing. We have tested for many days. The client for that service was 30+ and...
2
by: Philip Reimer | last post by:
Hello. We have here a Java web service that has been created using Apache Axis 1.4, using the document/literal wrapped style, and returns complex types in its methods. When consuming the web...
1
by: =?Utf-8?B?R29yZG9u?= | last post by:
Hi; I can consume a web service from an asp.net application with no problem. The web service connects to a remote server through ODBC and returns a data set to the consuming software. When...
0
by: menmaatre | last post by:
Hi all, I have a very odd problem: - System A: Win 2k3 with IIS 6 exposing a little WSDL Webservice - System B: Win 2k3 with MSSQL Server 2k5 - System C: RedHat Enterprise Server running...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.