2 Replies Latest reply on Jun 17, 2009 9:08 PM by gesrat

    Data Service Wizard - How can I reconfigure return type field as XML (E4X) value

    gesrat

      The HTTP Data Service wizard - "Reconfigure Return Type" - does not allow XML (E4X) to be selected as a data type for a field.  For example , If my example XML payload looks like this (see below), I would like to set the datatype for "settings" field to be XML (E4X) and have the service decode the "string" value into an XML (E4X) value.

       

       

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

      <ListOfUsers version="1.0.0">

          <User>

              <id>3</id>

              <subType>INTERNAL</subType>

              <authName>internal</authName>

              <name>Internal User</name>

              <settings>&lt;?xml version="1.0" encoding="utf-8" ?&gt;&lt;Settings&gt;&lt;Profile&gt;&lt;Region&gt;emea&lt;/Region&gt;&lt;Language&gt;en.g b&lt;/Language&gt;&lt;/Profile&gt;&lt;/Settings&gt;</settings>

          </User>

      </ListOfUsers>

        • 1. Re: Data Service Wizard - How can I reconfigure return type field as XML (E4X) value
          SunilAdobe Adobe Employee

          If the value of the field of a data type is another XML string, currently there is no way to handle that as XML string itself. But actually there is a way to convert that to a type as well (instead of using e4x, we recommend usage of strong typing).

           

          You can do that with the following steps. This is just a workaround

           

          1. Create another operation in your http service, with a dummy URL

          2. Configure the return type of that operation and in that enter that the return value of that as the XML (the settings XML string)

          3. Confirue return type will parse that and help you to create a Settings datatype in the model

          4. Now in the configure return type of the listofusers operation tell that the settings field is not an XML but Settings datatype

          5. Implement your own serializer and override deserializeResult to change the settings xml to the Settings data type and assign this serializer to the servicecontrol.serializationFilter

           

          I understand this is cumbersome, I have a filed a bug for us to support XML subelements in a more elegant way.

          Feel free to vote for it http://bugs.adobe.com/jira/browse/FB-20795

          • 2. Re: Data Service Wizard - How can I reconfigure return type field as XML (E4X) value
            gesrat Level 1

            I find a (reasonably) elegant workaround which is to add a transient property in the "public" sub class of the value type - see below - I havent tested it much so not sure if it will work adequateky in all circumstances

             

            package services.listeningpost

            {


            public class User_type extends _Super_User_type

            {


            public function get xmlSettings():XML

            {

            return new XML(settings);

            }


            public function set xmlSettings(object:XML):void

            {

            settings = object.toXMLString();

            }


            }


            }