Uploading a file(PDF,Image,MSWord) through rest Post service

Hi,

I’m trying to sending a file to the rest service where it has stream as input and using the streamtoFile service to write into the shared path.it is working for PDF/text file where the content type is coming as application/PDF,text/plain and it is not working for MSWord/excel file or Image.

and i observed for the text file where original file is changing in the destination.the content of the file is overriding with the boundary data.
and for pdf we able to see the actual file.

for ms word file the content type is coming as application/octet-stream
and for image it is coming as image/png.

it would be better if aby one suggest me,what is solution for this?

Hi Shakthi,
Can you try this?

Convert your stream to a mime object using createMimeData built in service, then get the content type from the header(I don’t exactly recall the service name, ull get it in the mime folder) and based on your content type you choose to write a file… for text files try with stringToFile - in this case get the mime body content(stream) n convert it to string for text file content type, for others do a streamToFile.

Thanks & Regards,
Sharadiya

Hi All,

It is working fine for all types of files now…
For MIME type files we have to use mime builtin services provided by webmethods ,below is the flow we have to use,

getTransportHeader
MergeHeaderandBody
CreateMIMEData
getBodyContentPart
StreamtoFile

Regards,
Sakthi

hi sakthi,

We are also working in the PDF file transfer to REST service. Could you please provide us some more details on the steps.

Thanks
Dinesh