- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
25-04-20 06:23 PM
For your reference I am getting the response as below as text type.
%PDF-1.4 %����
68 0 obj <</Linearized 1/L 1850803/O 70/E 262535/N 13/T 1849323/H [ 916 320]>> endobj
xref
68 31
0000000016 00000 n
0000001236 00000 n
0000001456 00000 n
0000001821 00000 n
0000001957 00000 n
0000002087 00000 n
0000002229 00000 n
0000002972 00000 n
0000003602 00000 n
0000004428 00000 n
0000005000 00000 n
0000005715 00000 n
I am not adding all the content here.
How can we save this content as a original file.
Please help, its an urgent.
Thanks
K
------------------------------
A Z
------------------------------
Answered! Go to Answer.
Helpful Answers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
27-04-20 11:57 AM
hmm, it seems that you will really need to call the WebApi through HTTP Client code (VB or C# code) to get the true binary stream not converted to text.
a skeleton can look like this (taken from SO)
byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(postString);
request.ContentLength = postBytes.Length;
Stream stream = request.GetRequestStream();
stream.Write(postBytes, 0, postBytes.Length);
stream.Close();
response = (HttpWebResponse)request.GetResponse();
Stream ReceiveStream = response.GetResponseStream();
string filename = "C:\\responseGot.txt";
byte[] buffer = new byte[1024];
FileStream outFile = new FileStream(filename, FileMode.Create);
int bytesRead;
while ((bytesRead = ReceiveStream.Read(buffer, 0, buffer.Length)) != 0)
outFile.Write(buffer, 0, bytesRead);
Regards,
------------------------------
Zdeněk Kabátek
Head of Professional Services
NEOOPS
http://www.neoops.com/
Europe/Prague
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
25-04-20 06:56 PM
------------------------------
Amador Yranon
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
25-04-20 07:06 PM
The actual file is a binary file(pdf, excel,ppt,word), not a text file.
------------------------------
A Z
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
25-04-20 07:46 PM
- VBO Rest API return collection
- VBO HTTP return text
Since end point return binary file e.g. pdf, excel, the only solution that i can think is using Code Stage write code like sample below:
------------------------------
Amador Yranon
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
26-04-20 04:30 AM
My query is, after receiving file data as text in response data item, how to convert the text into original file.
Can anyone please help.
------------------------------
A Z
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
27-04-20 08:17 AM
it is not clear what you are getting then. If you take the content of your Response open data item in Blue Prism containing the text and save it in clipboard and paste in notepad what the result is? The information you have provided is not sufficient to give you more hints.
Regards,
------------------------------
Zdeněk Kabátek
Head of Professional Services
NEOOPS
http://www.neoops.com/
Europe/Prague
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
27-04-20 11:37 AM
Please find the below image for your reference.
How can I convert the right side data (Response Content) as original Excel File.
Please let me know if any info required.
Thanks,
K
------------------------------
A Z
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
27-04-20 11:57 AM
hmm, it seems that you will really need to call the WebApi through HTTP Client code (VB or C# code) to get the true binary stream not converted to text.
a skeleton can look like this (taken from SO)
byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(postString);
request.ContentLength = postBytes.Length;
Stream stream = request.GetRequestStream();
stream.Write(postBytes, 0, postBytes.Length);
stream.Close();
response = (HttpWebResponse)request.GetResponse();
Stream ReceiveStream = response.GetResponseStream();
string filename = "C:\\responseGot.txt";
byte[] buffer = new byte[1024];
FileStream outFile = new FileStream(filename, FileMode.Create);
int bytesRead;
while ((bytesRead = ReceiveStream.Read(buffer, 0, buffer.Length)) != 0)
outFile.Write(buffer, 0, bytesRead);
Regards,
------------------------------
Zdeněk Kabátek
Head of Professional Services
NEOOPS
http://www.neoops.com/
Europe/Prague
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
27-04-20 12:08 PM
Will let you know after check with this code.
Thanks Again.
Thanks,
K
------------------------------
A Z
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-05-21 10:25 PM
Could you please let me know if you were able to download the file from WebApi.
If so could you please share your logic.
------------------------------
Sheela Parthasarathy
Assistant Consultant
TCS
Pacific/Apia
------------------------------
