views:

213

answers:

2

Hi, In retrieving data from a Oracle database that contains BLOB fields (Office's .doc files etc), do I have to do something particular to send it via web services?

It is sent like a string and I'm trying to convert the string into an array of bytes and write it to a file to recreate, client-side, the .doc file.

What is the correct approach?

+1  A: 

It isn't clear from the question, but it sounds like you have the data from the database, and now need to expose it on a web-service. In terms of SOAP etc, this can be as simple as either returning a byte[], or exposing a byte[] on a DTO. If the field is large, you may want to consider MTOM (WSE3) and/or web compression.

So: how does Oracle expose the BLOB to you? If it isn't a byte[], is it perhaps something like LINQ's Binary class, which provides encapsulated access to the data (ToArray() in this case). If it is exposing a string, I would guess that it is base-64 encoded; you could try running Convert.FromBase64String.

Marc Gravell
+1  A: 

You need to base64 encode the byte stream.

JD