Async task inside invoke code


I am consuming webservice which is giving response in SOAP with Attachment.
However using UiPath Http Request acitivity downloaded files are corrupted (excluding pdfs).
Content-Type: text/xml; charset=utf-8
Content-Transfer-Encoding: binary
Content-ID: ***

<?xml version="1.0" encoding="utf-8"?>020858ac-bca5-4e05-8e97-a04e67ed7bd8-dk-2dd5eee5-1d24-4d39-8375-cbb776bff14a

Content-Type: application/octet-stream
Content-Transfer-Encoding: 8bit
Content-ID: <020858ac-bca5-4e05-8e97-a04e67ed7bd8-dk-2dd5eee5-1d24-4d39-8375-cbb776bff14a>


I found solution here: c# - Get Attachment from SOAP Response and save file - Stack Overflow
However when i try to implement task class inside the invoke code acitivity it returns multiple errors that seem to be out of blue (missing ; or } etc.)

The question is - is usage of task class inside invoke code possible in UiPath or is there maybe any other way to get correct file out of this kind of response?


Did you use the response file as attachement field and provided the fulpath of the file?

And yes we can write the invoke code as well …make sure you import the required namespaces in the import at the bottom of studio and also makesure you select the correct programming language in the invoke code properties


Managed to implement solution from the link without using async syntax but indeed it looks like UiPath HTTP request activity doesn’t support downloading files as soap attachments.


Please try thsi

Is the response from SOAP a url or file only?


I tried this too but after passing wsdl url there is error “no valid contracts” (when I pass url in SoapUi however there are no problems at all - can the reason be that it’s IBM server?). Also, if I’m not mistaken activity you linked doesn’t handle file downloads so any response would need to be processed with multipart anyway.