0 Replies Latest reply on Aug 14, 2013 5:08 AM by Mr.Oz

    Inconsistent typing with HTTP Data Service and <mx:HTTPService>

    Mr.Oz Level 1

      I am using an HTTP Data Service, which strongly types data returned as xml from Youtube API. I also have an HTTPService object <HTTPService>. Each entry in the raw XML data they retrieve contains several namespaces, like this:

       

        <entry>

          <gd:comments>

            <gd:feedLink countHint="573986"/>

          </gd:comments>

          <media:group>

            <media:category label="Comedy" scheme="http://gdata.youtube.com/schemas/2007/categories.cat">Comedy</media:category>

            <media:player url="http://www.youtube.com/watch/>

            <media:thumbnail height="360" time="00:03:00"/>

            <media:title type="plain">Title</media:title>

            <yt:duration seconds="360"/>

          </media:group>

          <gd:rating average="4.6989236" max="5" min="1" numRaters="940187" rel="http://schemas.google.com/g/2005#overall"/>

          <yt:statistics favoriteCount="959236" viewCount="199961940"/>

        </entry>

       

      The Data Service uses an XMLSerializationFilter, which converts the namespaces so that colons become underscores.  Flash Builder's Data/Service wizard created a data type for each entry and its nodes. A resulting data object looks like this:


      data.gd_feedlink.countHit

      data.media_group.media_thumbnail.url
      data.media_group.media_category.label
      data.yt_statistics.favoriteCount

       

      The HTTPService removes the namespaces so the same data looks like this:


      data.feedlink.countHit

      data.group.thumbnail.url
      data.group.category.label
      data.statistics.favoriteCount

       

      If I set the HTTPService serializationFilter property to XMLSerializationFilter it prefixes the data with the namespaces like the Data Service, but all entries will be of the ObjectProxy type, even when its resultElementType property is set to the Entry type. Extensive reading and experimenting have failed to solve this.

       

      Is there any way to change either the Data Service or HTTPService so that the results use the same type and the same naming scheme? Preferably strongly typed like the Data Service's use of the Entry type.