The problem is caused by the xml content with the header. When we remove this content, the pdf file displays correctly.
The question is whether the Resourcepath content can be written to a string variable?
Because if I do this with a Result variable, the binary string is different from the ResourcePath (probably different encoding) and then the file is damaged
It would be awesome if we could reproduce this error on our end. Any chance you could provide help here (i.e. a project that reproduces this issue shared via a private message)?
One workaround, although not the greatest one, would be to perform the HTTP Request âmanuallyâ by using some code and the Invoke Code activity.
This is quite rough, but it worked for me for one project:
Dim myReq As System.Net.HttpWebRequest
Dim myResp As System.Net.HttpWebResponse
myReq = System.Net.HttpWebRequest.CreateHttp("URL")
myReq.Method = "GET"
myResp = DirectCast(myReq.GetResponse, System.Net.HttpWebResponse)
statusCode = myResp.StatusCode
statusDescription = myResp.StatusDescription
Dim myreader As New System.IO.StreamReader(myResp.GetResponseStream)
myText = myreader.ReadToEnd
Hi,
Iâve got a similar problem. A bot upload the file (in my case itâs an Outlook message) to an external system. The uploading runs well. However when I download (manually) the file on my PC I cannot open it because the file is corrupted. On top and at the bottom of the file are added some rows like you can see. Iâm curious to understand how you have solved it.
Thanks for your help
Hi mican,
I have already implemented this solution inside my workflow and it works fine!
Means that the file is saved in my folder correctly.
The problem happens when I use HTTP Request and I try to upload the file with a Post method in the company external system. The file is uploaded but is CORRUPTED.
For an unknown reason some rows are inserted on top and at the bottom of the file like previously posted.
The proof is if I remove these rows the file is opened perfectly.
Another strange thing is that if I try to post the same file using POSTMAN I can do it perfectly and the file once posted is downloadable without errors.
I setted in HTTP request the same parameters of POSTMAN, but doesnât work in the same way!!.
Any idea?
I havenât tested yet, but you might want to use the MimeKit library
Dim oRequest As System.Net.HttpWebRequest = CType(HttpWebRequest.Create("https://samplewebservice.com"), HttpWebRequest)
Dim msg As MimeEntity
Dim mime_Ct As MimeKit.ContentType
mime_ct= MimeKit.ContentType.Parse(oRequest.ContentType)
Dim mime_part As MimeKit.MimeEntity
mime_part= MimeEntity.Load(mime_ct, oRequest.GetRequestStream())
Dim muli_part As MimeKit.Multipart
muli_part=DirectCast(mime_part,Multipart)
Dim i As Integer
For Each attachment As MimePart In muli_part
Dim filename As String
filename = "attachment"+CType(i,String)+".txt"
Console.WriteLine(filename)
Dim stream As New FileStream(filename,FileMode.Create)
attachment.ContentObject.DecodeTo(stream)
i=i+1
Next
Thanks, You are telling me that I must to install the Mimekit package.
OK. I can do it, but I have no idea about how to invoke your code. Plz, can you post an example that explain how to run the code inside a workflow?
Ad1. Yes
Ad2. Yes, The red text is example
Ad3. Can you tell me what service it is (REST, SOAP)?
Maybe you will need authorization - login or password, certificate etc.
Describe the attachments (extension) and sample answer
Hi Mican,
The service is a REST.
The authorization is a simple http (username + password). No certificate.
The url is similar to âhttps://xxxxxaaaaaa.appiancloud.com/suite/webapi/0XD1_gâ.
The attachment is a .msg file (message file format of MS.Outlook).