FeaturesPluginsDocs & SupportCommunityPartners

NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

sending file

 
Post new topic   Reply to topic    NetBeans Forums -> Java ME Users
View previous topic :: View next topic  
Author Message
ASararu



Joined: 27 Aug 2009
Posts: 11

PostPosted: Mon Sep 28, 2009 11:23 am    Post subject: sending file Reply with quote

Is there any way i can send a .png file from the web service to the mobile client?

I tried to create on the web service an operation that will return an InputStream object created from the .png file. The only problem is that when NB creates the stubs in the mobile application the method which should return the InputStream object is seen as a void method. Any ideea why?
Back to top
View user's profile Send private message
ASararu



Joined: 27 Aug 2009
Posts: 11

PostPosted: Tue Sep 29, 2009 9:56 am    Post subject: Reply with quote

i've tried a different approach
.
On the server i have a method that has the return value as byte[].
i get this byte[] from the image i want to send to the mobile client.
On the client when i try to get the returned value of the server method i get this error:

java.rmi.MarshalException: Expected Byte, received: iVBORw0KGgoAAAANSUhEU.... (very long line)

the server code:

public byte[] getBytes() throws IOException {

BufferedImage chartImage = chart.createBufferedImage(230, 260);
//I get the image from a chart component.
ByteArrayOutputStream baos = new ByteArrayOutputStream(1000);


ImageIO.write( chartImage, "png",baos );


baos.flush();
byte[] bytesImage = baos.toByteArray();

baos.close();

return bytesImage;
}

the client code is simple. all i do is call the method created in the stubs by NB.

byte[] imageBytes = Stub.getBytes();//getBytes is the method on the server written above.

Any ideas how to resolve this error?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java ME Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB