4 Replies Latest reply on May 21, 2010 6:00 AM by MDCharton

    Import WSDL Not Creating All Functions

    MDCharton

      I am importing a .net webservice into a flexbuilder 3 project using the "Import Web Service (WSDL)" wizard, but the generated code is missing some functions.

       

      For example, we have two webservice operations called GetAllMFTs and GetAllStateWideF19s.  They both should return all records from their respective database tables, and as far as I can tell, the code in the webservice is written identically for both.  But when the import WSDL wizard is run, GetAllMFTs seems to have all necessary code and runs fine, but GetAllStateWideF19s is missing all the code for handling the returned data (I can call the function but there is no EventListener or lastResult).

       

      When I call the function from a Flex app, I can see in HTTPFox that the correct data is indeed being returned from the webservice--I just have no way of handling it through the generated code.  I can of course write this portion of the code myself, but I'd rather figure out why the import WSDL wizard isn't generating it automatically.

       

      I have seen the similar forum post here, but since we're not using xFire or Axis, it doesn't really help me.

       

      I have included the generated code for GetAllStateWideF19s below.  I can include the WSDL as well, if anyone thinks it's necessary... but the full thing is pretty long.  I'm really stuck on this one.  Thanks in advance.

       

       

       

       

              //stub functions for the GetAllStateWideF19S operation

       

              /**
               * @see IWsAGFCMarineFuelTax#GetAllStateWideF19S()
               */
              public function getAllStateWideF19S():AsyncToken
              {
                   var _internal_token:AsyncToken = _baseService.getAllStateWideF19S(_getAllStateWideF19S_header.authHeaderVB250);
                  _internal_token.addEventListener("result",_GetAllStateWideF19S_populate_results);
                  _internal_token.addEventListener("fault",throwFault);
                  return _internal_token;
              }
              /**
               * @see IWsAGFCMarineFuelTax#GetAllStateWideF19S_send()
               */   
              public function getAllStateWideF19S_send():AsyncToken
              {
                  return getAllStateWideF19S();
              }
                                 
              /**
               * Internal representation of the header wrapper
               * @private
               */
              private var _getAllStateWideF19S_header:Object;
              [Bindable]
              /**
               * @see IWsAGFCMarineFuelTax#getAllStateWideF19S_header
               */
              public function get getAllStateWideF19S_header():Object
              {
                  return _getAllStateWideF19S_header;
              }
              public function set getAllStateWideF19S_header(header:Object):void
              {
                  _getAllStateWideF19S_header = header;
              }
              /**
               * Add values for the various parts of the header
               * @param
               authHeaderVB250
               */
              public function addgetAllStateWideF19S_header(authHeaderVB250:com.agfc.AuthHeaderVB0):void
              {
                  _getAllStateWideF19S_header = new Object;
                  _getAllStateWideF19S_header.authHeaderVB250 = authHeaderVB250;
                           
              }
              /**
               * @private
               */
              private function _GetAllStateWideF19S_populate_results(event:ResultEvent):void
              { dispatchEvent(event); }

        • 1. Re: Import WSDL Not Creating All Functions
          MDCharton Level 1

          Are there any Adobe people monitoring these forums??

           

          I could really use some help.  At very least, I would like to know if the problem is likely on my end as the programmer (not sure how it could be since this is generated code), on the DBA's end (also doubtful to me after looking at his code and seeing it work fine in a .net app), a technology incompatibility issue, or a bug in FlexBuilder.

           

          I just don't know where to procede from here.  Any direction would be very much appreciated.

          • 3. Re: Import WSDL Not Creating All Functions
            Balaji Sridhar Level 2

            Hi,

             

            Please go ahead and file a bug in http://bugs.adobe.com/flex .

             

            Also i suggest you to use Flash Builder 4's Data Centric Development feature for Web Services.

             

            Thanks,

            Balaji

            • 4. Re: Import WSDL Not Creating All Functions
              MDCharton Level 1

              This has been pretty rediculous.

               

              I upgraded to Flash Builder and tried to use the so-called Data Centric Development features.  I suppose Adobe had their heart in the right place, and developers with very very simple Web Services will find these new features helpful... But I found the DCD extremely irritating.  It caused more problems than it solved.  For one thing, as far as I can tell, it does not support headers, so I would have had to write it myself... not a huge deal, but the Flex Builder Import Data Services Feature did this itself... so why degrade these features in the upgrade?!?  If the DCD does support this, it would be nice if Adobe would put out something showing how to use the features beyond just dragging and dropping web service classes onto datagrids... or is this all it is?  Extremely frustrating.

               

              Flash Builder has some really great improvements over Flex... but the DCD does not appear to be one of them (no matter how hard Adobe seems to be pushing it).  Regardless, I went back to Flex for this project and just wrote the missing code from the Import Data Service myself.

               

               

              This is what I had to change:

               

              In the "BaseWsMyWebservice" Function in "BaseWsMyWebservice.as", I found the section defining the incomplete operation "getMyData" and added

               

                          responseMessage.isWrapped = true;

                          responseMessage.wrappedQName = new QName("http://myNamespace.org/","GetMyDataResponse");

               

              In "WsMyWebservice.as", I replaced the incomplete "_GetMyData_populate_results" function with

               

                           /**

                          * Internal variable to store the operation's lastResult

                          * @private

                          */

                      private var _getMyData_lastResult:String;

                          [Bindable]

                          /**

                          * @see IWwMyWebservice#GetMyData_lastResult

                          */    

                          public function get getMyData_lastResult():String

                          {

                                return _getMyData_lastResult;

                          }

                          /**

                          * @private

                          */

                          public function set getMyData_lastResult(lastResult:String):void

                          {

                                _getMyData_lastResult = lastResult;

                          }

                         

                          /**

                          * @see IWsMyWebservice#addGetMyData()

                          */

                          public function addgetMyDataEventListener(listener:Function):void

                          {

                                addEventListener(GetMyDataResultEvent.GetMyData_RESULT,listener);

                          }

                         

                         

                          /**

                          * @private

                          */

                      private function _GetMyData_populate_results(event:ResultEvent):void

                          {

                                var e:GetMyDataResultEvent = new GetMyDataResultEvent();

                                      e.result = event.result as String;

                                                 e.headers = event.headers;

                                       getMyData_lastResult = e.result;

                                       dispatchEvent(e);}

               

              And added to the Event Declarations at the top:

               

                  /**

                   * Dispatches when a call to the operation GetMyData completes with success

                   * and returns some data

                   * @eventType GetMyData

                   */

                  [Event(name="GetMyData_result", type="com.MyProj.GetMyDataResultEvent")]

               

               

              I have no clue why it failed to generate these few lines of code... it works perfectly when they're added, but I'll have to write them again every time I refresh the service.  Very frustrating.  If anyone finds a fix or knows a possible cause, please let me know.