I'm not sure how a servlet can be expecting a String as input type for binary data (which is what you're trying to send). Maybe you can provide some more detail on this.
One way of converting binary data into a string representation is to encode with something like base-64, the output of which will consist entirely of US-ASCII characters. Of course, the receiving end (servlet) needs to be prepared to accept base64-encoded data.
The Jakarta Commons Codec library has a base-64 implementation.
Joined: Aug 22, 2007
My objective is to call a servlet by passing an xml file. The servlet currently takes the input xml file and returns output as xml. I will need to take this xml parse and store it into oracle table.
I have an xml file that is stored as a blob in oracle. I am reading that blob. Since servlet that is coded is not capable of dealing with blob, I need to convert it into a character stream and send it.
I am having difficulty trying to do that. Please adivise.
Joined: Mar 22, 2005
If it's an actual java.sql.Blob, then you can use its getBytes method to retrieve a byte, which you can then re-format to your hearts content.