8 Replies Latest reply on Feb 26, 2008 1:48 AM by GerryIsHere

    WebServiceConnector

    GerryIsHere Level 1
      Hi there!

      In the first frame I put an instance of WebServiceConnector (for Email Validation - http://www.webservicex.net/ValidateEmail.asmx?wsdl) and a TextInput component.
      Parameters, Bindings and Schemas are okay and well defined.

      BUT:
      How do I send my request of WebService?
      How do I get a False or a True reply which I can use in my AS?

      Many thanks in advance!
      Best regards,

      Gerry


        • 1. Re: WebServiceConnector
          GerryIsHere Level 1
          After some researches, I got from LiveDocs this code:
          ( http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?cont ext=Flash_MX_2004&file=00003012.html#3164554)


          import mx.data.components.WebServiceConnector;
          var res:Function = function (evt:Object) {
          trace(evt.target.results);
          };
          var wsConn:WebServiceConnector = new WebServiceConnector();
          wsConn.addEventListener("result", res);
          wsConn.WSDLURL = " http://www.webservicex.net/ValidateEmail.asmx?wsdl";
          wsConn.operation = "IsValidEmail";
          wsConn.params = ["Flash"];
          wsConn.suppressInvalidCalls = true;
          wsConn.trigger();

          But this is not accepted by Flash !!!
          I got this error message:

          **Error** Scene=Scene 1, layer=Actions, frame=122:Line 12: The class or interface 'WebServiceConnector' could not be loaded.
          var wsConn:WebServiceConnector = new WebServiceConnector();

          Total ActionScript Errors: 1 Reported Errors: 1

          Any clue ?
          • 2. Re: WebServiceConnector
            Greg Dove Level 4
            I don't get an error with that trying to replicate it in Flash CS3. At least not the import and instantiation part which was all that I tried.

            What version of flash are you using? Some earlier versions may not have had that component/class in the non "pro" version of flash.

            Also I would be inclined to make sure that you drag the Webservice connector component from your components panel onto the stage and then delete it from stage to make sure you have a copy in your library. If you can't see it in the components panel then I suspect you may have a version of flash where it is not available.
            • 3. Re: WebServiceConnector
              GerryIsHere Level 1
              Thank you for responding.

              I use Flash 8 Pro for Mac
              I do have the WebServiceConnector and the WebServiceClass in my File Library.
              And, of course I see it in the Component Panel (under "Data")!!!
              Please read my first post where I wrote I have set all the Parameters, Bindings and Schemas.

              :-)
              • 4. Re: WebServiceConnector
                Level 7
                I did a little test, in AS2 and this works:


                import mx.services.WebService;

                var myXML = new XML();
                var emailService = new
                WebService(" http://www.webservicex.net/ValidateEmail.asmx?wsdl");

                var callBack1 = emailService.IsValidEmail("dave@blurredistinction.com");
                callBack1.onResult = function(result)
                {
                myXML.parseXML(result);
                trace(myXML.firstChild.nodeValue);
                }




                --
                Dave -
                Head Developer
                http://www.blurredistinction.com
                Adobe Community Expert
                http://www.adobe.com/communities/experts/


                • 5. Re: WebServiceConnector
                  Greg Dove Level 4
                  My apologies...I didn't look at your first post because I was looking at the error you specified in your second.

                  I believe that error may be because flash cannot locate the WebServiceConnector class file in your regular class path... and I'm afraid I don't know what that path normally is on a Mac. (the class files are not in your library...the compiled component is... flash has the class files separately, normally all in one location for component classes).

                  It also may be unusual (although perhaps not a problem, I'm not sure) to have both a stage based/component panel configured connector with bindings etc and another one instantiated completely from code.
                  • 6. WebServiceConnector
                    GerryIsHere Level 1
                    OK. "Apologies" granted !!! :-)

                    If I look by the Window menu -->Common Libraries -->Classes, I do have in the panel which opens the DataBinding Classes, the UtilsClasses and the WebServiceClasses. So, the path is clearly defined and this the way I used to get the WebServiceClasses. I don't understand why I get the error message which is only related to the loading of the class.

                    I also tried to delete the component on the stage and got the same message...

                    To go to my first question:
                    If I keep an instance of the WebConnector on the stage, how can I trigger it with AS and not with a button? (I want a seamless process working in the background without any user action)

                    PS: How is the weather in my sweet France?
                    • 7. Re: WebServiceConnector
                      Greg Dove Level 4
                      I can't answer that question. Its been a long time since I tried something with that class/component. I was just hoping that my answer would come close. Someone else may know from more recent experience. (I tend to use amfphp/remoting for most of the remote service calls now). My only thoughts about your first question would be that you would probably do it the same as other components... give it an instance name (it won't show up when because its not visible), define the other parameters etc. And then use instanceName.trigger() in your code somewhere....but like I said, perhaps its better for someone else who has used it recently to answer.

                      But the problem does sound like it might be related to finding the class file for compiler checking. For example, all the regular flash classes also are defined in class files as well (although they have the keyword 'intrinsic' which basically means that the compiler doesn't have to compile them, just to check syntax). Your class file for those classes should be in a mx/data/components/ directory somewhere with all the other mx classpath items. I know where it is on windows.. but not on a mac.

                      France is very pleasant at the moment. It seems as if winter has left early.
                      • 8. Re: WebServiceConnector
                        GerryIsHere Level 1
                        quote:

                        Originally posted by: Newsgroup User
                        I did a little test, in AS2...


                        Sorry, my friend, I just received the alert about your post!
                        Better late than never...

                        I'll give it a try and give you some feedback.

                        Thank you for the time you dedicate to help me!
                        :-)

                        Regards,
                        Gerry