Sending PDF through HTTP Request with POST

Hi,
I have a doubt… I’m using HTTP Request to a POST method delivered by a client. It’s the first webservice communication I’m making with uipath.

I need to send a PDF document to that POST method and I know with uipath I just need to put the current path of the PDF in attachments.

My question begins there… When I send the file with POST I’ve received this error:

HTTP Status 500 - Request processing failed; nested exception is org.springframework.transaction.TransactionSystemException: Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: rollback failed

When I send it with OPTIONS I’ve Received an HTTP Status 200 but without results.

And at last I dont know what is specting the clients method. So I want to talk with them but first I need to know how works the uipath HTTP Request sending PDF files.

I need to know How they receive the PDF into the POST method. normally when we declare a method in a web service we need to declare the input param wich I think will be de PDF file but I dont know if the method will receive just the local path like a String, or if uipath transform de pdf into a bitmap variable that will be the input param or something else.

I hope you can help me understanding this.
Thank you

Hi @KevinDS,

This was a great topic to discuss, but I don’t know what you mean here by Options (You mean, the attachments or the Resource path?), as we are trying to send a file, we have a specific fields in the http request available here in the request itself which is with the name Attachments specifically for post request

same thing we have in post man also

image

So, we are uploading the files to the client through the http request

@HareeshMR Thank you for the Reply.

When I’ve said OPTIONS is one of the “Request Methods” (GET,POST,PUT,OPTIONS,etc…)

In the attachment have one variable called “Path” type String wich have the full local path of the pdf.

I’m discovering postman rightnow :open_mouth:

So, instead of that, you can send the attachment in POST request itself using the attachments underneath the headers as in the first screenshot above. Here also, you need to give the entire path of the file.

Its just a testing tool for the REST web services as we have SOAP UI as a testing tool for SOAP web services :slight_smile: @KevinDS

@HareeshMR thank you again.

I’ve tried POST with attachments:
image

But the result is this one:
HTTP Status 500 - Request processing failed; nested exception is org.springframework.transaction.TransactionSystemException: Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: rollback failed

May be the auto commit or auto rollback is there within the service class you are calling or it is being called automatically within the service @KevinDS

The thing is that I don’t know how to proceed in this case. Maybe the client has to modify something into his service class but I don’t know how what to say.

First of all, for the way you showed me the post into Postman uipath send the pdf as a binary data into the body of the method. right?

I’m thinking that maybe the client has another kind of input param to received and that may be the reason why is throwing that error. right?

Actually, the web services are the code which will be developed according to the requirement. May be the developer had written it as a post request, or with the options, or even the with the Merge request. and one more thing is the headers.If developer wants to have the according name as FiLE, then it must be the same while sending the request until unless, if he used regex in the code. That’s what it should be. So, make sure your API documentation needs the request type to be POST and the file is to be attached in binary (Post man terminology) .

So, what I mean to say is, please send the request according to your API documentation along with the headers and request type as required @KevinDS

Please let me know if it is confusing :blush:

image
…it’s might be make you laugh but please try once with replacing argument name from “path” with “file”.possibly it will work. @KevinDS

Hi, I am facing the similar problem. Trying to create a request which requires me to send the file as binary.
Tried the following postman configurations, that are working properly.