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.