Web service actionscript error

Posted by H P on Stack Overflow See other posts from Stack Overflow or by H P
Published on 2010-06-01T04:21:11Z Indexed on 2010/06/01 4:23 UTC
Read the original article Hit count: 234

Hello,

I am new to Flex and needed some help setting up Web service client.

I have a web service of method:

 public String printEchoStr(String str);

I am facing problem while creating action script to call this service. I am getting error:

1067: Implicit coercion of a value of type String to an unrelated type
 generated.webservices:PrintEcho.

I am not sure if this is the correct way.

Thanks,

-H

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
    xmlns:srv="generated.webservices.*"
    creationComplete="initFunc()">
    <mx:Script>
        <![CDATA[
            import generated.webservices.EchoService;
            import generated.webservices.PrintEchoStrResultEvent;
            import generated.webservices.PrintEchoResultEvent;
            import mx.rpc.events.ResultEvent;
            import mx.rpc.events.FaultEvent;
            import mx.controls.Alert;
            import generated.webservices.PrintEchoStr;
            import generated.webservices.PrintEcho;

            public var myService:EchoService = new EchoService();

            private function initFunc():void{
                myService.addprintEchoStrEventListener(argPrintEchoStr);
/*--------------
 1067: Implicit coercion of a value of type String to an unrelated type 
 generated.webservices:PrintEcho. at line below
----------------*/
                myService.printEchoStr(textAreaPrintEchoStr.text); 
                myService.addEventListener(FaultEvent.FAULT,myServices_faultHandler);
            }

            public function argPrintEchoStr(event:PrintEchoStrResultEvent):void{
                trace(event.result);
            }

            private function myServices_faultHandler(event:FaultEvent):void {
                Alert.show(event.fault.faultString,"error with WebServices");
            }

        ]]>
    </mx:Script>
    <mx:TextArea id ="textAreaPrintEchoStr" 
        x="81" y="125"/>

</mx:Application>

© Stack Overflow or respective owner

Related posts about web-services

Related posts about actionscript