Go Back   kirupaForum > Development > Other Programming (Java, C, C++, etc.)

Reply
 
Thread Tools Display Modes
Old 11-29-2009, 01:12 PM   #1
OmniNL
Registered User
Deserialize AMF in Java

How do i deserialize AMF data in Java that comes through a socket?

(I use Flash ide)

Last edited by OmniNL; 12-04-2009 at 04:33 AM.. Reason: Removed wall of text, going simple mode
OmniNL is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?
 

Old 12-01-2009, 04:43 AM   #2
OmniNL
Registered User
Nobody? This problem is keeping me busy for a week now. Getting desperate.

Ive read alot of pages but they all leave out the info that i seek!
for example: link

They leave out the part how they receive the data sent to java. which stream to use etc.. getting crazy.

Last edited by OmniNL; 12-01-2009 at 04:50 AM..
OmniNL is offline   Reply With Quote
Old 12-01-2009, 05:10 AM   #3
Krilnon
≈ ≠ =
 
Krilnon's Avatar
Location Rochester, NY

Posts 7,183
I'm sure someone can help you here; I could, but I don't have any time to write any sort of explanation and won't for a while.

AS3 and Java both support (either natively or through some library) numerous forms of serialization. For example, SOAP, AMF, and JSON (although it's not really the same as serialization) can all be used to some extent to transfer objects between Java and Flash.
Krilnon is offline   Reply With Quote
Old 12-01-2009, 06:34 AM   #4
OmniNL
Registered User
I know about the serialization part, i use AMF. I just don't know how receive them in Java and then edit them. Using:
PHP Code:
new BufferedReader(new InputStreamReader(socket.getInputStream())); 
Gives me the string, i can send it back just fine but i want to edit some variables server side and then send it back, it doesn't work that way though since then the serialization gets corrupted or something. (flash reads the input as undefined)

Say im sending 2 strings in flash (keeping it very simple, there is more to send)
PHP Code:
socket.writeIntuser_ID );
socket.writeUTFBytesmessage ); 
Then i want to be able to access those 2 variables in Java, edit the message, keep the user_ID. And send it back to Flash.

So all i need to know is how to read the socket stream in java to be able to read/edit the variables
OmniNL is offline   Reply With Quote
Old 12-01-2009, 07:07 AM   #5
Krilnon
≈ ≠ =
 
Krilnon's Avatar
Location Rochester, NY

Posts 7,183
Quote:
Originally Posted by OmniNL
I know about the serialization part, i use AMF. I just don't know how receive them in Java and then edit them
When I was talking about serialization support, I was also (implicitly) talking about deserialization, which is what you're having trouble with. Java's default object (de)serialization doesn't use AMF; that's why you're getting errors. You need to use some library (like BlazeDS) that knows how to handle AMF.
Krilnon is offline   Reply With Quote
Old 12-01-2009, 07:43 AM   #6
OmniNL
Registered User
Quote:
Originally Posted by Krilnon View Post
When I was talking about serialization support, I was also (implicitly) talking about deserialization, which is what you're having trouble with. Java's default object (de)serialization doesn't use AMF; that's why you're getting errors. You need to use some library (like BlazeDS) that knows how to handle AMF.
Ah thanks for giving me a direction, ill check it out
Edit: I use Adobe Flash CS4 and not flex, And BlazeDS seems to be only for flex. Can i still use it?

EDIT2: I read you need a servlet container or something like tomcat? Is this true?

Last edited by OmniNL; 12-04-2009 at 04:35 AM..
OmniNL is offline   Reply With Quote
Old 01-12-2010, 08:52 AM   #7
Eric Drutel
Registered User
You could embed jety or tomcat in your application and use as a servlet container. http://docs.codehaus.org/display/JETTY/Embedding+Jetty http://lacson.name/archives/2004/12/..._embed_to.html
Eric Drutel is offline   Reply With Quote
Old 01-26-2010, 08:10 AM   #8
icio
looks better in lowercase
 
icio's Avatar
Location Edinburgh, Scotland

Posts 3,689
Here's the specification for AMF should you fancy writing your own AMF (de)serializer:

http://opensource.adobe.com/wiki/dow...c_05_05_08.pdf

I know that Zend Framework has a PHP AMF server -- you could look at how they do it.
icio is offline   Reply With Quote
Old 01-26-2010, 08:17 AM   #9
OmniNL
Registered User
Ah thanks, i shall read that when i have the time. I actually gave up trying but this should blow some new life in my projects again
OmniNL is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:40 PM.

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
Flash effects. Art without coding. Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Learn how to advertise on kirupa.com
 

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com