Here's the complete code if anyone is interest, if anyone disagree
with anything reply me ;)
[Bindable]
public var webService:WebService;
public function wsHelloWorld():void{
// initialization that only needs to be called
once
webService = new WebService();
webService.wsdl = myWsdl.text;
webService.loadWSDL();
webService.addEventListener(LoadEvent.LOAD,
readyHelloWorld);
webService.addEventListener(ResultEvent.RESULT,
resultListener);
}
public function readyHelloWorld(ready:LoadEvent):void{
// call web service function Is Ready
webService.HelloWorld(myInput.text);
}
public function resultListener(event:ResultEvent):void {
// handle result of webservice
trace(event.result);
}
--- In [email protected], "hugocorept" <[EMAIL PROTECTED]> wrote:
>
> Hey thanks for the Help, that really light me!
> So, i write something like this..
>
> [Bindable]
> public var webService:WebService;
>
> public function wsHelloWorld():void{
>
>
> // initialization that only needs to be called
> once
> if (!webService) {
> webService = new WebService();
> webService.wsdl = myWsdl.text;
> webService.loadWSDL();
>
> webService.addEventListener(LoadEvent.LOAD, readyHelloWorld);
>
> webService.addEventListener(ResultEvent.RESULT, resultListener);
> }
>
> }
>
> public function readyHelloWorld():void{
> // call web service function Is Ready
> webService.HelloWorld(myInput.text);
> }
>
> public function resultListener(event:ResultEvent):void {
> // handle result of webservice
> trace(event.result);
> }
>
> This is giving me: Argument count mismatch on main/readyHelloWorld().
> Expected 0, got 1.
>
>
> :s hum...
> Grate for the help, Core
>
> --- In [email protected], "Daniel Freiman" <FreimanCQ@> wrote:
> >
> > Actually, I may have screwed this up because loadWSDL is also
> asynchronous.
> > Remove the first line of wsHelloWorld (initHelloWorld()) and just
> make sure
> > to call initHelloWorld well before you call wsHelloWorld. Really
> you should
> > add an eventListener to webService for LoadEvent.LOAD and not call
> > helloworld until that LOAD has been received once. Unfortunately, I
> have to
> > go do something right now so I can't write that up. Sorry for the
> confusion
> >
> > Dan Freiman
> > nondocs <http://nondocs.blogspot.com>
> >
> >
> > On 5/18/07, Daniel Freiman <freimancq@> wrote:
> > >
> > > Hello world is an asynchronous call so the trace function will be
> called
> > > before HelloWorld is completed. Instead try this:
> > >
> > > [Bindable]
> > > public var webService:WebService;
> > >
> > > public function wsHelloWorld():void{
> > > initHelloWorld();
> > > webService.HelloWorld(myInput.text); // call web service function
> > > }
> > >
> > > public function initHelloWorld():void{
> > > // initialization that only needs to be called once
> > > if (!webService) {
> > > webService = new WebService();
> > > webService.wsdl = myWsdl.text;
> > > webService.loadWSDL();
> > > webService.addEventListener(ResultEvent.RESULT, resultListener);
> > > }
> > > }
> > >
> > > public function resultListener(event:ResultEvent):void {
> > > // handle result of webservice
> > > trace(event.result );
> > > }
> > >
> > > Dan Freiman
> > > nondocs <http://nondocs.blogspot.com>
> > >
> > >
> > > On 5/18/07, hugocorept <hugocore@ > wrote:
> > > >
> > > > Hellooooo you flexers
> > > >
> > > > Well, i have created an WebService in AS, because in the mxml
> tag way,
> > > > the WSDL derived from an TextInput does NOT WORK.. :( sad... so i
> > > > create this simple AS but i cant get the lastResult successful,
> Always
> > > > give me null in the beginning, click again, and then the
result, and
> > > > for last [Object Object], can you light me :P ?
> > > >
> > > > [Bindable] public var webService:WebService = new WebService;
> > > >
> > > > public function wsHelloWorld():void{
> > > > webService.wsdl = myWsdl.text;
> > > > webService.loadWSDL();
> > > > webService.HelloWorld(myInput.text);
> > > > trace(webService.HelloWorld.lastResult);
> > > >
> > > > }
> > > >
> > > > null
> > > > Hello, testee (--> This is the THING!!)
> > > > [object Object] (--> This enter in HelloWorldResponse Object, ??)
> > > >
> > > > Hope you can help on this,
> > > > Grate for all the help!
> > > >
> > > >
> > > >
> > >
> > >
> >
>