4 Replies Latest reply on Aug 24, 2010 2:29 AM by lukas_r

    WSDL Proxy Code Generation: No More Strongly Typed ResultEvent Classes?

    lukas_r

      Dear all,

       

      We are disigning a Flex application which connects to a local SOAP web service. When I use Flash Builder 4 to generate the proxy code form the WSDL to access the web service's methods, I get AS classes for the custom data types and the service class with all the methods. Looking at the code, Flash Builder has correctly figured out the return type of all the methods as well. But how on earth can I safely use them at compile time? In other words, where have the custom, strongly typed ResultEvents gone?

       

      For the pre-release version of Flash Builder 4 (and FB 3) I find this:

       

       

      Generated fileDescription
      OperationnameResultEvent.asFor each web service operation, Flash Builder generates a strongly typed event type class. You can use these classes to benefit from strongly typed results.

      (http://livedocs.adobe.com/flex/gumbo/html/WS6f97d7caa66ef6eb1e63e3d11b6c4d0d21-7e11.html)

       

      In the final version, the corresponding document ("Automatically generating web service proxies") is nowhere to be found. So, where have the custom ResultEvent classes gone? How do I use my web service in a type-safe manner? This is absolutely crucial for us -- the underlying web service WILL change, and I will not accept the possibility of breaking the application because of this, especially since all the necessary information is available.

       

      On a side note: Is it possible to create Exception stubs for the well-defined (in the WSDL) SOAP Faults? That would be a great help also.

       

      I hope this is just an oversight on my part. Any help is appreciated.

       

      Thanks,

      Lukas

       

      Edit: add link to "old" docu

        • 1. Re: WSDL Proxy Code Generation: No More Strongly Typed ResultEvent Classes?
          Sameer Bhatt Adobe Employee

          The result you get from the operation's invocation will be strongly typed. If you are using a CallResponder, the lastResult property will contain the result (strongly typed). You can cast (or use the as operator) - var book:BookVO = responder.lastResult as BookVO;

          • 2. Re: WSDL Proxy Code Generation: No More Strongly Typed ResultEvent Classes?
            lukas_r Level 1

            Thanks for your answer, Sameer. Yes, I see what you're saying, but it's not what I'm looking for. As you say, I need to explicitly cast the result to the known return type. But what if the return type in the WSDL changes for a given web service method? Even though I regenerate the proxy classes, my application will still fail, at run time! I'll have to manually change all the cast statements throughout the code base. This is not necessary, is it? I want to be able to write type-safe code and know the return type at compile time. Especially since the code generator actually knows the type. In my understanding, the custom ResultEvents that were previously generated allow exactly that. So I reiterate: where have they gone, suddenly? How am I supposed to tackle this?

             

            Thanks,

            Lukas

            • 3. Re: WSDL Proxy Code Generation: No More Strongly Typed ResultEvent Classes?
              Sameer Bhatt Adobe Employee

              The data wizards which existed in Flex Builder 3 are replaced by Data Centric Development (Feature) in Flash Builder 4 which offers a better way of working with different types of services.

               

              In your case, you can use a model to store the results. Then, you'll be required to change the cast in one place only i.e., the model.

               

              More articles on web-services (using DCD) here -

              http://sujitreddyg.wordpress.com/flash-builder-4/#webservice

               

              -Sameer

              • 4. Re: WSDL Proxy Code Generation: No More Strongly Typed ResultEvent Classes?
                lukas_r Level 1

                I have had a look at those articles, and they don't go beyond stock functionality. I must say that I can't see how a "model" is going to help, either. I would have to write a wrapper for every single web service method, or rather, write my own Event classes. In any case, that means manual work and testing every time the WSDL changes. Disappointing, especially since the required functionality was apparently there in the previous version of Flash Builder.

                 

                I also take it that there is no way to automatically generate Exceptions classes which correspond to SOAP faults. Too bad. I think Adobe should look to improve in these areas in the next version.

                 

                Thanks anyway,

                Lukas