| View previous topic :: View next topic |
| Author |
Message |
ASararu
Joined: 27 Aug 2009 Posts: 11
|
Posted: Mon Sep 28, 2009 11:23 am Post subject: sending file |
|
|
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 |
|
 |
ASararu
Joined: 27 Aug 2009 Posts: 11
|
Posted: Tue Sep 29, 2009 9:56 am Post subject: |
|
|
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 |
|
 |
|
|
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
|
|
|
|