Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 828451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:43:33+00:00 2026-05-15T03:43:33+00:00

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

  • 0

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>

Generated source of EchoService.as
EchoService.as

    package generated.webservices
{
    import mx.rpc.AsyncToken;
    import flash.events.EventDispatcher;
    import mx.rpc.events.ResultEvent;
    import mx.rpc.events.FaultEvent;
    import flash.utils.ByteArray;
    import mx.rpc.soap.types.*;

    /**
     * Dispatches when a call to the operation printEcho completes with success
     * and returns some data
     * @eventType PrintEchoResultEvent
     */
    [Event(name="PrintEcho_result", type="generated.webservices.PrintEchoResultEvent")]

    /**
     * Dispatches when a call to the operation printEchoStr completes with success
     * and returns some data
     * @eventType PrintEchoStrResultEvent
     */
    [Event(name="PrintEchoStr_result", type="generated.webservices.PrintEchoStrResultEvent")]

    /**
     * Dispatches when the operation that has been called fails. The fault event is common for all operations
     * of the WSDL
     * @eventType mx.rpc.events.FaultEvent
     */
    [Event(name="fault", type="mx.rpc.events.FaultEvent")]

    public class EchoService extends EventDispatcher implements IEchoService
    {
        private var _baseService:BaseEchoService;

        /**
         * Constructor for the facade; sets the destination and create a baseService instance
         * @param The LCDS destination (if any) associated with the imported WSDL
         */  
        public function EchoService(destination:String=null,rootURL:String=null)
        {
            _baseService = new BaseEchoService(destination,rootURL);
        }

        //stub functions for the printEcho operation


        /**
         * @see IEchoService#printEcho()
         */
        public function printEcho(printEcho:PrintEcho):AsyncToken
        {
            var _internal_token:AsyncToken = _baseService.printEcho(printEcho);
            _internal_token.addEventListener("result",_printEcho_populate_results);
            _internal_token.addEventListener("fault",throwFault); 
            return _internal_token;
        }
        /**
         * @see IEchoService#printEcho_send()
         */    
        public function printEcho_send():AsyncToken
        {
            return printEcho(_printEcho_request.printEcho);
        }

        /**
         * Internal representation of the request wrapper for the operation
         * @private
         */
        private var _printEcho_request:PrintEcho_request;
        /**
         * @see IEchoService#printEcho_request_var
         */
        [Bindable]
        public function get printEcho_request_var():PrintEcho_request
        {
            return _printEcho_request;
        }

        /**
         * @private
         */
        public function set printEcho_request_var(request:PrintEcho_request):void
        {
            _printEcho_request = request;
        }

            /**
         * Internal variable to store the operation's lastResult
         * @private
         */
        private var _printEcho_lastResult:PrintEchoResponse;
        [Bindable]
        /**
         * @see IEchoService#printEcho_lastResult
         */   
        public function get printEcho_lastResult():PrintEchoResponse
        {
            return _printEcho_lastResult;
        }
        /**
         * @private
         */
        public function set printEcho_lastResult(lastResult:PrintEchoResponse):void
        {
            _printEcho_lastResult = lastResult;
        }

        /**
         * @see IEchoService#addprintEcho()
         */
        public function addprintEchoEventListener(listener:Function):void
        {
            addEventListener(PrintEchoResultEvent.PrintEcho_RESULT,listener);
        }

        /**
         * @private
         */
        private function _printEcho_populate_results(event:ResultEvent):void
        {
            var e:PrintEchoResultEvent = new PrintEchoResultEvent();
                    e.result = event.result as PrintEchoResponse;
                               e.headers = event.headers;
                     printEcho_lastResult = e.result;
                     dispatchEvent(e);
                    }

        //stub functions for the printEchoStr operation


        /**
         * @see IEchoService#printEchoStr()
         */
        public function printEchoStr(printEchoStr:PrintEchoStr):AsyncToken
        {
            var _internal_token:AsyncToken = _baseService.printEchoStr(printEchoStr);
            _internal_token.addEventListener("result",_printEchoStr_populate_results);
            _internal_token.addEventListener("fault",throwFault); 
            return _internal_token;
        }
        /**
         * @see IEchoService#printEchoStr_send()
         */    
        public function printEchoStr_send():AsyncToken
        {
            return printEchoStr(_printEchoStr_request.printEchoStr);
        }

        /**
         * Internal representation of the request wrapper for the operation
         * @private
         */
        private var _printEchoStr_request:PrintEchoStr_request;
        /**
         * @see IEchoService#printEchoStr_request_var
         */
        [Bindable]
        public function get printEchoStr_request_var():PrintEchoStr_request
        {
            return _printEchoStr_request;
        }

        /**
         * @private
         */
        public function set printEchoStr_request_var(request:PrintEchoStr_request):void
        {
            _printEchoStr_request = request;
        }

            /**
         * Internal variable to store the operation's lastResult
         * @private
         */
        private var _printEchoStr_lastResult:PrintEchoStrResponse;
        [Bindable]
        /**
         * @see IEchoService#printEchoStr_lastResult
         */   
        public function get printEchoStr_lastResult():PrintEchoStrResponse
        {
            return _printEchoStr_lastResult;
        }
        /**
         * @private
         */
        public function set printEchoStr_lastResult(lastResult:PrintEchoStrResponse):void
        {
            _printEchoStr_lastResult = lastResult;
        }

        /**
         * @see IEchoService#addprintEchoStr()
         */
        public function addprintEchoStrEventListener(listener:Function):void
        {
            addEventListener(PrintEchoStrResultEvent.PrintEchoStr_RESULT,listener);
        }

        /**
         * @private
         */
        private function _printEchoStr_populate_results(event:ResultEvent):void
        {
            var e:PrintEchoStrResultEvent = new PrintEchoStrResultEvent();
                    e.result = event.result as PrintEchoStrResponse;
                               e.headers = event.headers;
                     printEchoStr_lastResult = e.result;
                     dispatchEvent(e);
                    }

        //service-wide functions
        /**
         * @see IEchoService#getWebService()
         */
        public function getWebService():BaseEchoService
        {
            return _baseService;
        }

        /**
         * Set the event listener for the fault event which can be triggered by each of the operations defined by the facade
         */
        public function addEchoServiceFaultEventListener(listener:Function):void
        {
            addEventListener("fault",listener);
        }

        /**
         * Internal function to re-dispatch the fault event passed on by the base service implementation
         * @private
         */

         private function throwFault(event:FaultEvent):void
         {
            dispatchEvent(event);
         }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:43:33+00:00Added an answer on May 15, 2026 at 3:43 am
    myService.printEchoStr(textAreaPrintEchoStr.text);
    

    printEchoStr method of EchoService class expects a PrintEcho object, but you’re passing textAreaPrintEchoStr.text, which is a String

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.