wood burning stoves*
The moose likes Web Services and the fly likes How to convert incoming Multipart to base64binary Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to convert incoming Multipart to base64binary" Watch "How to convert incoming Multipart to base64binary" New topic
Author

How to convert incoming Multipart to base64binary

Adam Kronicki
Ranch Hand

Joined: Sep 01, 2009
Posts: 68
I have the following problem. My webservice is a two-way inteface. From one side it is a REST interface which takes a POST method that accepts a MultiPart message (it is a audio file). Now I need to send this file again to another server with a SOAP interface as a base64binary attachment. I tried to this like this:

But this doesn't work (the server does not recognize the file and when i try to save it it's size is 0kb. I found a way to overcome this- I first save the multipart message to HDD and read it again with :

However this is a little bit dull first to save the file and read it again from the HDD. Does any one have another idea on how to convert more 'directly' the MultiPart to Base64binary DataHandler?
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Have you tried creating the DataHandler instance with an additional argument specifying the mime type of the data?
For additional information, see the DataHandler API documentation and the second constructor.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
Adam Kronicki
Ranch Hand

Joined: Sep 01, 2009
Posts: 68
Thanks for the help but this does not solve the problem however the error message is different. Before the error was(shoudl have postet that before):

And After adding the MIME type("audio/x-wav") the error is:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to convert incoming Multipart to base64binary