2 Replies Latest reply on Jun 1, 2010 6:42 AM by _H_P_

    Web Service compile time error

    _H_P_ Level 1



      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


      I am not sure if this is the correct way.





      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
                  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{
       1067: Implicit coercion of a value of type String to an unrelated type 
       generated.webservices:PrintEcho. at line below
                  public function argPrintEchoStr(event:PrintEchoStrResultEvent):void{
                  private function myServices_faultHandler(event:FaultEvent):void {
                      Alert.show(event.fault.faultString,"error with WebServices");
          <mx:TextArea id ="textAreaPrintEchoStr" 
              x="81" y="125"/>
        • 1. Re: Web Service compile time error
          BhaskerChari Level 4



          Are you getting the error for the line below




          If so then there might be a mismatch in the argument that is being passed to your service method "printEchoStr".


          You are passing "textAreaPrintEchoStr.text" which is a data type String and  check whether the data type is the same on your server method or not.


          I hope the argument datatype is not the same(i.e; string) instead it is of type PrintEcho.


          Check your webservice method once.


          If this problem still persists let me know.



          If this post answers your question or helps, please kindly mark it as such.


          Bhasker Chari

          1 person found this helpful
          • 2. Re: Web Service compile time error
            _H_P_ Level 1



            Yes, myService.printEchoStr() doesnot take a String argument.


            I am facing trouble with creating Web service. I want to send a parameter to the web service


            String printEchoStr(String str);


            and print its response in textArea.