10 Replies Latest reply on May 24, 2007 2:45 PM by psconnolly

    WebService bad element / not resolvable


      I am trying to connect to a web service I have built with Java. When I send my web service request from Flex, I get the following error:

      [WSDLError faultString="Element http://geovista.psu.edu/campus:generateListImage not resolvable" faultCode="WSDL.BadElement" faultDetail="null"]
      at mx.rpc.soap::WSDLParser/ http://www.adobe.com/2006/flex/mx/internal::parseMessage()
      at mx.rpc.soap::WSDLOperation/parseMessages()
      at mx.rpc.soap::Operation/ http://www.adobe.com/2006/flex/mx/internal::invokePendingCall()
      at mx.rpc.soap::Operation/ http://www.adobe.com/2006/flex/mx/internal::invokeAllPending()
      at mx.rpc.soap::WebService/::unEnqueueCalls()
      at mx.rpc.soap::WebService/ http://www.adobe.com/2006/flex/mx/internal::wsdlHandler()
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.rpc.soap::WSDLParser/dispatchEvent()
      at mx.rpc.soap::WSDLParser/::parseCompleted()

      I have read that this may be because Flex does not support import statements in the wsdl file. I am wondering if this is true or if I should be looking at another reason why my web service request is not working? If this is true, does anyone know of a workaround?

        • 1. Re: WebService bad element / not resolvable
          scottpez Level 1
          Ok, I am a little confused by this, but I seem to have figured out when my web service request works and when it does not. The web service request was giving the error I mentioned before, when I put the operation.send() call in the creationComplete event of my application. If I add a button which the user has to click, that does the same operation.send(), everything works fine. Does anyone know why this may be? I would like the web service request to be sent when the user enters the application. Is there another way to do this?

          I am creating an <mx:WebService> element in my application mxml file. I may try to create it programatically in AS within the creationComplete event of my application and see how that goes.

          • 2. Re: WebService bad element / not resolvable
            scottpez Level 1

            I finally figured out the problem and found a solution. The problem was that the creationComplete event was being fired before the webservice component was able to load the wsdl file. The solution that seems to work is to create the mx:WebService component just as I had before except add a function that is called on its load event. So something like this:

            <mx:WebService id="generator" wsdl="..." load="sendOperation();">

            And then in the creationComplete event of the application, I have generator.loadWSDL();. Finally, in the function sendOperation() I send the operation something like this generator.generateOperation.send();.

            Therefore the webservice operation is not sent until the wsdl has loaded. This seems to work for me.

            • 3. Re: WebService bad element / not resolvable
              I had the same problem with my application. Your solution works.
              • 4. Re: WebService bad element / not resolvable
                Angry_Coder Level 1
                I had the same problem with my application. Your solution works.
                • 5. Re: WebService bad element / not resolvable
                  I get the same error when i try to connect to a web service in my machine. Nothing seems to work. Not even when "send() " is called from a button.

                  Is there anything else i need to set up to access a web service on a local machine ?

                  • 6. Re: WebService bad element / not resolvable
                    Hello, everyone.
                    (First, I'm sorry my poor English.... )

                    Recentry, I saw the same situation.
                    In my case, this error happends when the target WebService is based on .NET, using SQL Server & SQLXML3.0.

                    I've been provided my WebServices based on these technology, and had no problem when I used Flex1.5 and Flex2.0.

                    After updating my Flex Builder to 2.0.1, this error happends.
                    (I tried to test the same applications compiled by Flex Builder2.0 and Flex Builder 2.0.1, then, only the later one has the problem.)

                    I find that only the "First" send is failed and any data is not send to the server.
                    But the later send requests are not failed.
                    So that I handle this problem with retrying when exception is happened.

                    Like this:

                    <mx:Webservice id="ws" .../>

                    try {
                    } catch (e:Error) {
                    // retry!

                    I wonder why this trouble comes after using Flex Builder 2.0.1 and why another webservice are not failed....
                    It seems this is caused from WSDL format but the WSDL is auto-generated by SQLXML, so I have no way to change the WSDL.

                    Anyway, I manage to work my application like above.
                    I hope this post is any help for you......
                    • 7. Re: WebService bad element / not resolvable
                      SoxFan33 Level 1
                      I tried adding a try/catch around my WebService send statements as suggested, and it worked as described. Thanks!

                      I'd really like to know if anyone has figured out a way to prevent the error from occurring in the first place, though. I have tried forcing the WSDL to load by calling loadWSDL on my web service in a function bound to the onLoad event (effectively loading it twice, I believe), but it hasn't worked.
                      • 8. Re: WebService bad element / not resolvable
                        Clever work-around, but jeez, it just doesn't seem right to have to do that in order to get 'creationComplete' to work correctly! When 'creationComplete' executes, it seems to me that all forms and dataProviders should be ready to roll...

                        And if the problem just cropped up in 2.0.1, PERHAPS JUST MAYBE it's a bug? Has anyone reported this to Adobe?
                        • 9. Re: WebService bad element / not resolvable
                          Suama Level 1
                          I've reported to Adobe after reading this topic:
                          http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=583&threadid=1262290#45 64499

                          Because I found this problem when updating Flex Builder to 2.0.1 from 2.0.
                          And I received email from Adobe that this bug will be fixed with Flex 2.5.

                          • 10. Re: WebService bad element / not resolvable
                            psconnolly Level 1
                            Thanks Suama,

                            This looks like an older bug from the August 2006 timeframe:

                            RE: [flexcoders] Re: WSDLError:Element not resolvable => LoadEvent doesn't imply service ready

                            that has popped up again. Hopefully Adobe can smash it in a 2.0.x release...?