• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

File as Attachment in J2ME client

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
I have made a java web service. Which takes SQL query, Username and password of Database to connect to and the file name which i want to give to the created text file as parameters and it returns a text file. Now, I want to receive the same file ( stored at server side) on J2ME client side. If i make a normal Java web service client then I can get the file using DataHandler. However, I am not able to get the file as attachment using the DataHandler at J2ME client side. It said it does not recognize DataHandler, however I tried and the server side code returns the datahandler as byte[]. I tried to take the advantage and in J2ME client took the result as byte[]. But no use It is giving me Uncaught exception java/lang/NullPointerException. Can you please look into it. I am attaching the files, Server side code and the client side code and the files made as stub.
The client side code is here


The server side code is ::



Thanks in advance
Lokesh
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I understood you correctly, you want to download text file from server with your j2me client, and it should be response from java webservice.
Maybe this link would be helpful
http://www.java-samples.com/showtutorial.php?tutorialid=15
You can modify it to make proper ws request
 
lokesh jain
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, you are right, we can do like that. However, I need to get the file as attachment to client side, not getting the Byte Array. Is this possible that, we get the text file and store it in RMS and then read it from RMS itself??

regards
Lokesh
 
Aleksandar Babic
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can store anything in RMS including objects (check Floggy framework)
I'm not sure you can get anything except byte array but you can deserialize it to something useful

Are you trying to send mail with attachment?
For reading attachment you may need some j2me mail api.
 
Can you hear that? That's my theme music. I don't know where it comes from. Check under this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic