You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by CodeGirl <Mi...@yahoo.com> on 2016/08/15 19:05:04 UTC

.jpg images via SOAP webservice using SQL Server as DB

I have some small images in .jpg format.  
After some reading, I concluded my files were small enough to store in the
database but I was told to make the type  varbinary(max)   No problem so far

When I created my Entities JPA wanted to make it a byte[].  Seems no
problem.

I defined my DTO object byte[]  No Problem.

In FlashBuilder, I use the WSDL Wizard to creat my service stuff as usual.

I noticed it created the ValueObject with a ByteArray type.

Here is my result handler

		protected function getImagesResult_resultHandler(event:ResultEvent):void
		{
			dataList = new ArrayCollection();
			if (event.result != null)
			{
				if (event.result is ArrayCollection)
				{
					dataList = getImagesResult.lastResult;
				}
				else
				{
					dataList.addItem(toDTO(event.result));
				}
			}
		}
		
		public static function toDTO(o:Object):ImageDTO
		{
			var thisDTO:ImageDTO = new ImageDTO();
			thisDTO.id = o.id;
			thisDTO.name = o.name;
			thisDTO.width = o.width;
			thisDTO.length = o.length;
			thisDTO.height = o.height;
			thisDTO.sideid = o.sideid;
			thisDTO.pic = o.pic;
			return thisDTO;
		}
		

But when I run my app and I call getImages()

I get this error:

ReferenceError: Error #1065: Variable ByteArray is not defined.
	at global/flash.utils::getDefinitionByName()
	at
com.adobe.serializers.utility::TypeUtility$/assignProperty()[C:\depot\flex\ide_trunk\ide_builder\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serializers\utility\TypeUtility.as:593]
	at
com.adobe.serializers.utility::TypeUtility$/convertToStrongType()[C:\depot\flex\ide_trunk\ide_builder\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serializers\utility\TypeUtility.as:562]
	at
com.adobe.serializers.utility::TypeUtility$/convertListToStrongType()[C:\depot\flex\ide_trunk\ide_builder\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serializers\utility\TypeUtility.as:518]
	at
com.adobe.serializers.utility::TypeUtility$/convertResultHandler()[C:\depot\flex\ide_trunk\ide_builder\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serializers\utility\TypeUtility.as:431]
	at
mx.rpc.soap::Operation/http://www.adobe.com/2006/flex/mx/internal::processResult()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\soap\Operation.as:953]
	at
mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:313]
	at
mx.rpc::Responder/result()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\Responder.as:56]
	at
mx.rpc::AsyncRequest/acknowledge()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:84]
	at
DirectHTTPMessageResponder/completeHandler()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:451]
	at flash.events::EventDispatcher/dispatchEventFunction()
	at flash.events::EventDispatcher/dispatchEvent()
	at flash.net::URLLoader/onComplete()


Evidently, This is a bug in FlashBuilder.   

So since I am using SOAP and Flashbuilder to create my service and
valueObjects.  

How should I do images?  Or is there a workaround to this problem?



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/jpg-images-via-SOAP-webservice-using-SQL-Server-as-DB-tp13300.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: .jpg images via SOAP webservice using SQL Server as DB

Posted by CodeGirl <Mi...@yahoo.com>.
I had converted it to a string so I wouldnt crash when i ran it.  So I added
a new variable called testpic.  

Here are the DTO, Super_, and EntityMetadata for that valueObject

/**
 * This is a generated sub-class of _ImageDTO.as and is intended for
behavior
 * customization.  This class is only generated when there is no file
already present
 * at its target location.  Thus custom behavior that you add here will
survive regeneration
 * of the super-class. 
 *
 * NOTE: Do not manually modify the RemoteClass mapping unless
 * your server representation of this class has changed and you've 
 * updated your ActionScriptGeneration,RemoteClass annotation on the
 * corresponding entity 
 **/ 
 
package valueObjects
{

import com.adobe.fiber.core.model_internal;

public class ImageDTO extends _Super_ImageDTO
{
    /** 
     * DO NOT MODIFY THIS STATIC INITIALIZER - IT IS NECESSARY
     * FOR PROPERLY SETTING UP THE REMOTE CLASS ALIAS FOR THIS CLASS
     *
     **/
     
    /**
     * Calling this static function will initialize RemoteClass aliases
     * for this value object as well as all of the value objects
corresponding
     * to entities associated to this value object's entity.  
     */     
    public static function _initRemoteClassAlias() : void
    {
       
_Super_ImageDTO.model_internal::initRemoteClassAliasSingle(valueObjects.ImageDTO);
        _Super_ImageDTO.model_internal::initRemoteClassAliasAllRelated();
    }
     
    model_internal static function initRemoteClassAliasSingleChild() : void
    {
       
_Super_ImageDTO.model_internal::initRemoteClassAliasSingle(valueObjects.ImageDTO);
    }
    
    {
       
_Super_ImageDTO.model_internal::initRemoteClassAliasSingle(valueObjects.ImageDTO);
    }
    /** 
     * END OF DO NOT MODIFY SECTION
     *
     **/    
}

}

/**
 * This is a generated class and is not intended for modification.  To
customize behavior
 * of this value object you may modify the generated sub-class of this class
- ImageDTO.as.
 */

package valueObjects
{
import com.adobe.fiber.services.IFiberManagingService;
import com.adobe.fiber.valueobjects.IValueObject;
import flash.events.EventDispatcher;
import flash.utils.ByteArray;
import mx.collections.ArrayCollection;
import mx.events.PropertyChangeEvent;

import flash.net.registerClassAlias;
import flash.net.getClassByAlias;
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.valueobjects.IPropertyIterator;
import com.adobe.fiber.valueobjects.AvailablePropertyIterator;

use namespace model_internal;

[ExcludeClass]
public class _Super_ImageDTO extends flash.events.EventDispatcher implements
com.adobe.fiber.valueobjects.IValueObject
{
    model_internal static function initRemoteClassAliasSingle(cz:Class) :
void
    {
    }

    model_internal static function initRemoteClassAliasAllRelated() : void
    {
    }

    model_internal var _dminternal_model : _ImageDTOEntityMetadata;
    model_internal var _changedObjects:mx.collections.ArrayCollection = new
ArrayCollection();

    public function getChangedObjects() : Array
    {
        _changedObjects.addItemAt(this,0);
        return _changedObjects.source;
    }

    public function clearChangedObjects() : void
    {
        _changedObjects.removeAll();
    }

    /**
     * properties
     */
    private var _internal_height : int;
    private var _internal_id : int;
    private var _internal_length : int;
    private var _internal_name : String;
    private var _internal_pic : String;
    private var _internal_picurl : String;
    private var _internal_sideid : int;
    private var _internal_testpic : ByteArray;
    private var _internal_width : int;

    private static var emptyArray:Array = new Array();


    /**
     * derived property cache initialization
     */
    model_internal var _cacheInitialized_isValid:Boolean = false;

    model_internal var _changeWatcherArray:Array = new Array();

    public function _Super_ImageDTO()
    {
        _model = new _ImageDTOEntityMetadata(this);

        // Bind to own data or source properties for cache invalidation
triggering

    }

    /**
     * data/source property getters
     */

    [Bindable(event="propertyChange")]
    public function get height() : int
    {
        return _internal_height;
    }

    [Bindable(event="propertyChange")]
    public function get id() : int
    {
        return _internal_id;
    }

    [Bindable(event="propertyChange")]
    public function get length() : int
    {
        return _internal_length;
    }

    [Bindable(event="propertyChange")]
    public function get name() : String
    {
        return _internal_name;
    }

    [Bindable(event="propertyChange")]
    public function get pic() : String
    {
        return _internal_pic;
    }

    [Bindable(event="propertyChange")]
    public function get picurl() : String
    {
        return _internal_picurl;
    }

    [Bindable(event="propertyChange")]
    public function get sideid() : int
    {
        return _internal_sideid;
    }

    [Bindable(event="propertyChange")]
    public function get testpic() : ByteArray
    {
        return _internal_testpic;
    }

    [Bindable(event="propertyChange")]
    public function get width() : int
    {
        return _internal_width;
    }

    public function clearAssociations() : void
    {
    }

    /**
     * data/source property setters
     */

    public function set height(value:int) : void
    {
        var oldValue:int = _internal_height;
        if (oldValue !== value)
        {
            _internal_height = value;
           
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this,
"height", oldValue, _internal_height));
        }
    }

    public function set id(value:int) : void
    {
        var oldValue:int = _internal_id;
        if (oldValue !== value)
        {
            _internal_id = value;
           
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this,
"id", oldValue, _internal_id));
        }
    }

    public function set length(value:int) : void
    {
        var oldValue:int = _internal_length;
        if (oldValue !== value)
        {
            _internal_length = value;
           
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this,
"length", oldValue, _internal_length));
        }
    }

    public function set name(value:String) : void
    {
        var oldValue:String = _internal_name;
        if (oldValue !== value)
        {
            _internal_name = value;
           
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this,
"name", oldValue, _internal_name));
        }
    }

    public function set pic(value:String) : void
    {
        var oldValue:String = _internal_pic;
        if (oldValue !== value)
        {
            _internal_pic = value;
           
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this,
"pic", oldValue, _internal_pic));
        }
    }

    public function set picurl(value:String) : void
    {
        var oldValue:String = _internal_picurl;
        if (oldValue !== value)
        {
            _internal_picurl = value;
           
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this,
"picurl", oldValue, _internal_picurl));
        }
    }

    public function set sideid(value:int) : void
    {
        var oldValue:int = _internal_sideid;
        if (oldValue !== value)
        {
            _internal_sideid = value;
           
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this,
"sideid", oldValue, _internal_sideid));
        }
    }

    public function set testpic(value:ByteArray) : void
    {
        var oldValue:ByteArray = _internal_testpic;
        if (oldValue !== value)
        {
            _internal_testpic = value;
           
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this,
"testpic", oldValue, _internal_testpic));
        }
    }

    public function set width(value:int) : void
    {
        var oldValue:int = _internal_width;
        if (oldValue !== value)
        {
            _internal_width = value;
           
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this,
"width", oldValue, _internal_width));
        }
    }

    /**
     * Data/source property setter listeners
     *
     * Each data property whose value affects other properties or the
validity of the entity
     * needs to invalidate all previously calculated artifacts. These
include:
     *  - any derived properties or constraints that reference the given
data property.
     *  - any availability guards (variant expressions) that reference the
given data property.
     *  - any style validations, message tokens or guards that reference the
given data property.
     *  - the validity of the property (and the containing entity) if the
given data property has a length restriction.
     *  - the validity of the property (and the containing entity) if the
given data property is required.
     */


    /**
     * valid related derived properties
     */
    model_internal var _isValid : Boolean;
    model_internal var _invalidConstraints:Array = new Array();
    model_internal var _validationFailureMessages:Array = new Array();

    /**
     * derived property calculators
     */

    /**
     * isValid calculator
     */
    model_internal function calculateIsValid():Boolean
    {
        var violatedConsts:Array = new Array();
        var validationFailureMessages:Array = new Array();

        var propertyValidity:Boolean = true;

        model_internal::_cacheInitialized_isValid = true;
        model_internal::invalidConstraints_der = violatedConsts;
        model_internal::validationFailureMessages_der =
validationFailureMessages;
        return violatedConsts.length == 0 && propertyValidity;
    }

    /**
     * derived property setters
     */

    model_internal function set isValid_der(value:Boolean) : void
    {
        var oldValue:Boolean = model_internal::_isValid;
        if (oldValue !== value)
        {
            model_internal::_isValid = value;
            _model.model_internal::fireChangeEvent("isValid", oldValue,
model_internal::_isValid);
        }
    }

    /**
     * derived property getters
     */

    [Transient]
    [Bindable(event="propertyChange")]
    public function get _model() : _ImageDTOEntityMetadata
    {
        return model_internal::_dminternal_model;
    }

    public function set _model(value : _ImageDTOEntityMetadata) : void
    {
        var oldValue : _ImageDTOEntityMetadata =
model_internal::_dminternal_model;
        if (oldValue !== value)
        {
            model_internal::_dminternal_model = value;
           
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this,
"_model", oldValue, model_internal::_dminternal_model));
        }
    }

    /**
     * methods
     */


    /**
     *  services
     */
    private var
_managingService:com.adobe.fiber.services.IFiberManagingService;

    public function set
managingService(managingService:com.adobe.fiber.services.IFiberManagingService):void
    {
        _managingService = managingService;
    }

    model_internal function set invalidConstraints_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_invalidConstraints;
        // avoid firing the event when old and new value are different empty
arrays
        if (oldValue !== value && (oldValue.length > 0 || value.length > 0))
        {
            model_internal::_invalidConstraints = value;
            _model.model_internal::fireChangeEvent("invalidConstraints",
oldValue, model_internal::_invalidConstraints);
        }
    }

    model_internal function set validationFailureMessages_der(value:Array) :
void
    {
        var oldValue:Array = model_internal::_validationFailureMessages;
        // avoid firing the event when old and new value are different empty
arrays
        if (oldValue !== value && (oldValue.length > 0 || value.length > 0))
        {
            model_internal::_validationFailureMessages = value;
           
_model.model_internal::fireChangeEvent("validationFailureMessages",
oldValue, model_internal::_validationFailureMessages);
        }
    }


}

}



/**
 * This is a generated class and is not intended for modification.  
 */
package valueObjects
{
import com.adobe.fiber.styles.IStyle;
import com.adobe.fiber.styles.Style;
import com.adobe.fiber.valueobjects.AbstractEntityMetadata;
import com.adobe.fiber.valueobjects.AvailablePropertyIterator;
import com.adobe.fiber.valueobjects.IPropertyIterator;
import flash.utils.ByteArray;
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.valueobjects.IModelType;
import mx.events.PropertyChangeEvent;

use namespace model_internal;

[ExcludeClass]
internal class _ImageDTOEntityMetadata extends
com.adobe.fiber.valueobjects.AbstractEntityMetadata
{
    private static var emptyArray:Array = new Array();

    model_internal static var allProperties:Array = new Array("height",
"id", "length", "name", "pic", "picurl", "sideid", "testpic", "width");
    model_internal static var allAssociationProperties:Array = new Array();
    model_internal static var allRequiredProperties:Array = new Array();
    model_internal static var allAlwaysAvailableProperties:Array = new
Array("height", "id", "length", "name", "pic", "picurl", "sideid",
"testpic", "width");
    model_internal static var guardedProperties:Array = new Array();
    model_internal static var dataProperties:Array = new Array("height",
"id", "length", "name", "pic", "picurl", "sideid", "testpic", "width");
    model_internal static var sourceProperties:Array = emptyArray
    model_internal static var nonDerivedProperties:Array = new
Array("height", "id", "length", "name", "pic", "picurl", "sideid",
"testpic", "width");
    model_internal static var derivedProperties:Array = new Array();
    model_internal static var collectionProperties:Array = new Array();
    model_internal static var collectionBaseMap:Object;
    model_internal static var entityName:String = "ImageDTO";
    model_internal static var dependentsOnMap:Object;
    model_internal static var dependedOnServices:Array = new Array();
    model_internal static var propertyTypeMap:Object;


    model_internal var _instance:_Super_ImageDTO;
    model_internal static var _nullStyle:com.adobe.fiber.styles.Style = new
com.adobe.fiber.styles.Style();

    public function _ImageDTOEntityMetadata(value : _Super_ImageDTO)
    {
        // initialize property maps
        if (model_internal::dependentsOnMap == null)
        {
            // dependents map
            model_internal::dependentsOnMap = new Object();
            model_internal::dependentsOnMap["height"] = new Array();
            model_internal::dependentsOnMap["id"] = new Array();
            model_internal::dependentsOnMap["length"] = new Array();
            model_internal::dependentsOnMap["name"] = new Array();
            model_internal::dependentsOnMap["pic"] = new Array();
            model_internal::dependentsOnMap["picurl"] = new Array();
            model_internal::dependentsOnMap["sideid"] = new Array();
            model_internal::dependentsOnMap["testpic"] = new Array();
            model_internal::dependentsOnMap["width"] = new Array();

            // collection base map
            model_internal::collectionBaseMap = new Object();
        }

        // Property type Map
        model_internal::propertyTypeMap = new Object();
        model_internal::propertyTypeMap["height"] = "int";
        model_internal::propertyTypeMap["id"] = "int";
        model_internal::propertyTypeMap["length"] = "int";
        model_internal::propertyTypeMap["name"] = "String";
        model_internal::propertyTypeMap["pic"] = "String";
        model_internal::propertyTypeMap["picurl"] = "String";
        model_internal::propertyTypeMap["sideid"] = "int";
        model_internal::propertyTypeMap["testpic"] = "ByteArray";
        model_internal::propertyTypeMap["width"] = "int";

        model_internal::_instance = value;
    }

    override public function getEntityName():String
    {
        return model_internal::entityName;
    }

    override public function getProperties():Array
    {
        return model_internal::allProperties;
    }

    override public function getAssociationProperties():Array
    {
        return model_internal::allAssociationProperties;
    }

    override public function getRequiredProperties():Array
    {
         return model_internal::allRequiredProperties;   
    }

    override public function getDataProperties():Array
    {
        return model_internal::dataProperties;
    }

    public function getSourceProperties():Array
    {
        return model_internal::sourceProperties;
    }

    public function getNonDerivedProperties():Array
    {
        return model_internal::nonDerivedProperties;
    }

    override public function getGuardedProperties():Array
    {
        return model_internal::guardedProperties;
    }

    override public function getUnguardedProperties():Array
    {
        return model_internal::allAlwaysAvailableProperties;
    }

    override public function getDependants(propertyName:String):Array
    {
       if (model_internal::nonDerivedProperties.indexOf(propertyName) == -1)
            throw new Error(propertyName + " is not a data property of
entity ImageDTO");
            
       return model_internal::dependentsOnMap[propertyName] as Array;  
    }

    override public function getDependedOnServices():Array
    {
        return model_internal::dependedOnServices;
    }

    override public function getCollectionProperties():Array
    {
        return model_internal::collectionProperties;
    }

    override public function getCollectionBase(propertyName:String):String
    {
        if (model_internal::collectionProperties.indexOf(propertyName) ==
-1)
            throw new Error(propertyName + " is not a collection property of
entity ImageDTO");

        return model_internal::collectionBaseMap[propertyName];
    }
    
    override public function getPropertyType(propertyName:String):String
    {
        if (model_internal::allProperties.indexOf(propertyName) == -1)
            throw new Error(propertyName + " is not a property of
ImageDTO");

        return model_internal::propertyTypeMap[propertyName];
    }

    override public function
getAvailableProperties():com.adobe.fiber.valueobjects.IPropertyIterator
    {
        return new
com.adobe.fiber.valueobjects.AvailablePropertyIterator(this);
    }

    override public function getValue(propertyName:String):*
    {
        if (model_internal::allProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " does not exist for entity
ImageDTO");
        }

        return model_internal::_instance[propertyName];
    }

    override public function setValue(propertyName:String, value:*):void
    {
        if (model_internal::nonDerivedProperties.indexOf(propertyName) ==
-1)
        {
            throw new Error(propertyName + " is not a modifiable property of
entity ImageDTO");
        }

        model_internal::_instance[propertyName] = value;
    }

    override public function
getMappedByProperty(associationProperty:String):String
    {
        switch(associationProperty)
        {
            default:
            {
                return null;
            }
        }
    }

    override public function getPropertyLength(propertyName:String):int
    {
        switch(propertyName)
        {
            default:
            {
                return 0;
            }
        }
    }

    override public function isAvailable(propertyName:String):Boolean
    {
        if (model_internal::allProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " does not exist for entity
ImageDTO");
        }

        if
(model_internal::allAlwaysAvailableProperties.indexOf(propertyName) != -1)
        {
            return true;
        }

        switch(propertyName)
        {
            default:
            {
                return true;
            }
        }
    }

    override public function getIdentityMap():Object
    {
        var returnMap:Object = new Object();

        return returnMap;
    }

    [Bindable(event="propertyChange")]
    override public function get invalidConstraints():Array
    {
        if
(model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return
model_internal::_instance.model_internal::_invalidConstraints;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid =
model_internal::_instance.model_internal::calculateIsValid();
            return
model_internal::_instance.model_internal::_invalidConstraints;        
        }
    }

    [Bindable(event="propertyChange")]
    override public function get validationFailureMessages():Array
    {
        if
(model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return
model_internal::_instance.model_internal::_validationFailureMessages;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid =
model_internal::_instance.model_internal::calculateIsValid();
            return
model_internal::_instance.model_internal::_validationFailureMessages;
        }
    }

    override public function
getDependantInvalidConstraints(propertyName:String):Array
    {
        var dependants:Array = getDependants(propertyName);
        if (dependants.length == 0)
        {
            return emptyArray;
        }

        var currentlyInvalid:Array = invalidConstraints;
        if (currentlyInvalid.length == 0)
        {
            return emptyArray;
        }

        var filterFunc:Function = function(element:*, index:int,
arr:Array):Boolean
        {
            return dependants.indexOf(element) > -1;
        }

        return currentlyInvalid.filter(filterFunc);
    }

    /**
     * isValid
     */
    [Bindable(event="propertyChange")] 
    public function get isValid() : Boolean
    {
        if
(model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return model_internal::_instance.model_internal::_isValid;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid =
model_internal::_instance.model_internal::calculateIsValid();
            return model_internal::_instance.model_internal::_isValid;
        }
    }

    [Bindable(event="propertyChange")]
    public function get isHeightAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isIdAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isLengthAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isNameAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isPicAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isPicurlAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isSideidAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isTestpicAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isWidthAvailable():Boolean
    {
        return true;
    }


    /**
     * derived property recalculation
     */

    model_internal function fireChangeEvent(propertyName:String,
oldValue:Object, newValue:Object):void
    {
       
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this,
propertyName, oldValue, newValue));
    }

    [Bindable(event="propertyChange")]   
    public function get heightStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get idStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get lengthStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get nameStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get picStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get picurlStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get sideidStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get testpicStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get widthStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }


     /**
     * 
     * @inheritDoc 
     */ 
     override public function
getStyle(propertyName:String):com.adobe.fiber.styles.IStyle
     {
         switch(propertyName)
         {
            default:
            {
                return null;
            }
         }
     }
     
     /**
     * 
     * @inheritDoc 
     *  
     */  
     override public function
getPropertyValidationFailureMessages(propertyName:String):Array
     {
         switch(propertyName)
         {
            default:
            {
                return emptyArray;
            }
         }
     }

}

}




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/jpg-images-via-SOAP-webservice-using-SQL-Server-as-DB-tp13300p13319.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

AW: .jpg images via SOAP webservice using SQL Server as DB

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi,


I am sending image data as byte-array from BlazeDS to my Flex application without any problems. But I just checked the beginning of this thread ... as you are using SOAP I guess you will have to Base64 encode the data as the raw byte data could contain any XML character to mess up things.


Chris

________________________________
Von: Alex Harui <ah...@adobe.com>
Gesendet: Mittwoch, 17. August 2016 02:13:03
An: users@flex.apache.org
Betreff: Re: .jpg images via SOAP webservice using SQL Server as DB



On 8/16/16, 9:36 AM, "CodeGirl" <Mi...@yahoo.com> wrote:

>Here is a suggested work around.
>
>http://stackoverflow.com/questions/25255030/as3-loading-images-binary-xml-
>to-flash
>
>What is an FLA?

A FLA is the project file for Adobe Flash Professional.

>
>I am guessing the suggestion here is in JPA on my backend, convert my
>varbinary(MAX) to a String.
>
>Let SOAP send it as a String.  Let the Value Object be a String.  Then
>when
>I want to display the image,
>I apply the decoder in the link above to convert the string to a
>ByteArray.
>Of course I still need to figure out how I send the data from ByteArray
>to a
>BinaryImage.   I am new to using images.  My apps are normally really
>plain.
>

This is not my area of expertise, but AIUI, you might be better off
getting the backend to send the image as base64 as suggested in the
article you linked to, but do it by getting the data type to match one of
the base64 types in this article:

http://help.adobe.com/en_US/Flex/4.0/AccessingData/WS2db454920e96a9e51e63e3
d11c0bf69084-7fdb.html

I think if you can do that, the SOAPDecoder will convert the data to a
ByteArray properly.  I think the way it is set up right now is throwing an
error because the generic decoder can't decode directly to ByteArray.  I
think it needs to know that it is Base64-encoded.

HTH,
-Alex


Re: .jpg images via SOAP webservice using SQL Server as DB

Posted by Alex Harui <ah...@adobe.com>.

On 8/16/16, 9:36 AM, "CodeGirl" <Mi...@yahoo.com> wrote:

>Here is a suggested work around.
>
>http://stackoverflow.com/questions/25255030/as3-loading-images-binary-xml-
>to-flash
>
>What is an FLA?

A FLA is the project file for Adobe Flash Professional.

>
>I am guessing the suggestion here is in JPA on my backend, convert my
>varbinary(MAX) to a String.
>
>Let SOAP send it as a String.  Let the Value Object be a String.  Then
>when
>I want to display the image,
>I apply the decoder in the link above to convert the string to a
>ByteArray. 
>Of course I still need to figure out how I send the data from ByteArray
>to a
>BinaryImage.   I am new to using images.  My apps are normally really
>plain.
>

This is not my area of expertise, but AIUI, you might be better off
getting the backend to send the image as base64 as suggested in the
article you linked to, but do it by getting the data type to match one of
the base64 types in this article:

http://help.adobe.com/en_US/Flex/4.0/AccessingData/WS2db454920e96a9e51e63e3
d11c0bf69084-7fdb.html

I think if you can do that, the SOAPDecoder will convert the data to a
ByteArray properly.  I think the way it is set up right now is throwing an
error because the generic decoder can't decode directly to ByteArray.  I
think it needs to know that it is Base64-encoded.

HTH,
-Alex


Re: .jpg images via SOAP webservice using SQL Server as DB

Posted by CodeGirl <Mi...@yahoo.com>.
Here is a suggested work around.  

http://stackoverflow.com/questions/25255030/as3-loading-images-binary-xml-to-flash

What is an FLA?

I am guessing the suggestion here is in JPA on my backend, convert my
varbinary(MAX) to a String.

Let SOAP send it as a String.  Let the Value Object be a String.  Then when
I want to display the image,
I apply the decoder in the link above to convert the string to a ByteArray. 
Of course I still need to figure out how I send the data from ByteArray to a
BinaryImage.   I am new to using images.  My apps are normally really plain.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/jpg-images-via-SOAP-webservice-using-SQL-Server-as-DB-tp13300p13320.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: .jpg images via SOAP webservice using SQL Server as DB

Posted by Alex Harui <ah...@adobe.com>.
Please post the code for the ValueObject.  Or a link to the code.

Thanks,
-Alex

On 8/15/16, 12:05 PM, "CodeGirl" <Mi...@yahoo.com> wrote:

>I have some small images in .jpg format.
>After some reading, I concluded my files were small enough to store in the
>database but I was told to make the type  varbinary(max)   No problem so
>far
>
>When I created my Entities JPA wanted to make it a byte[].  Seems no
>problem.
>
>I defined my DTO object byte[]  No Problem.
>
>In FlashBuilder, I use the WSDL Wizard to creat my service stuff as usual.
>
>I noticed it created the ValueObject with a ByteArray type.
>
>Here is my result handler
>
>		protected function getImagesResult_resultHandler(event:ResultEvent):void
>		{
>			dataList = new ArrayCollection();
>			if (event.result != null)
>			{
>				if (event.result is ArrayCollection)
>				{
>					dataList = getImagesResult.lastResult;
>				}
>				else
>				{
>					dataList.addItem(toDTO(event.result));
>				}
>			}
>		}
>		
>		public static function toDTO(o:Object):ImageDTO
>		{
>			var thisDTO:ImageDTO = new ImageDTO();
>			thisDTO.id = o.id;
>			thisDTO.name = o.name;
>			thisDTO.width = o.width;
>			thisDTO.length = o.length;
>			thisDTO.height = o.height;
>			thisDTO.sideid = o.sideid;
>			thisDTO.pic = o.pic;
>			return thisDTO;
>		}
>		
>
>But when I run my app and I call getImages()
>
>I get this error:
>
>ReferenceError: Error #1065: Variable ByteArray is not defined.
>	at global/flash.utils::getDefinitionByName()
>	at
>com.adobe.serializers.utility::TypeUtility$/assignProperty()[C:\depot\flex
>\ide_trunk\ide_builder\com.adobe.flexbuilder.dcrad\serializers\src\com\ado
>be\serializers\utility\TypeUtility.as:593]
>	at
>com.adobe.serializers.utility::TypeUtility$/convertToStrongType()[C:\depot
>\flex\ide_trunk\ide_builder\com.adobe.flexbuilder.dcrad\serializers\src\co
>m\adobe\serializers\utility\TypeUtility.as:562]
>	at
>com.adobe.serializers.utility::TypeUtility$/convertListToStrongType()[C:\d
>epot\flex\ide_trunk\ide_builder\com.adobe.flexbuilder.dcrad\serializers\sr
>c\com\adobe\serializers\utility\TypeUtility.as:518]
>	at
>com.adobe.serializers.utility::TypeUtility$/convertResultHandler()[C:\depo
>t\flex\ide_trunk\ide_builder\com.adobe.flexbuilder.dcrad\serializers\src\c
>om\adobe\serializers\utility\TypeUtility.as:431]
>	at
>mx.rpc.soap::Operation/http://www.adobe.com/2006/flex/mx/internal::process
>Result()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\soap\Operation.as
>:953]
>	at
>mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::result
>Handler()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.
>as:313]
>	at
>mx.rpc::Responder/result()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc
>\Responder.as:56]
>	at
>mx.rpc::AsyncRequest/acknowledge()[E:\dev\4.5.1\frameworks\projects\rpc\sr
>c\mx\rpc\AsyncRequest.as:84]
>	at
>DirectHTTPMessageResponder/completeHandler()[E:\dev\4.5.1\frameworks\proje
>cts\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:451]
>	at flash.events::EventDispatcher/dispatchEventFunction()
>	at flash.events::EventDispatcher/dispatchEvent()
>	at flash.net::URLLoader/onComplete()
>
>
>Evidently, This is a bug in FlashBuilder.
>
>So since I am using SOAP and Flashbuilder to create my service and
>valueObjects.  
>
>How should I do images?  Or is there a workaround to this problem?
>
>
>
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/jpg-images-via-SOAP-webserv
>ice-using-SQL-Server-as-DB-tp13300.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.