Home > Forum > Actions > Call REST Web service action

Call REST Web service action
0

Hey team
We are intensively testing Webcon. I'm trying to send a PDF attachment in a simple app using the HTTP POST method, and I can't get it to work. Postman works fine, Python too.

How can I adjust my action to make it go through? We prepared it based on this article:
https://kb.webcon.pl/przekazywanie-zalacznikow-do-google-drive-za-pomoca-akcji-rest/

Unfortunately, it doesn't want to load the PDF file in the request. Any idea why? I attached also screenshots of action configuration.

See logs below:

OG_ID
LOG_DEFID
LOG_WFDID
LOG_WTHID
LOG_STPID
LOG_ACTID
LOG_Status
LOG_TSInsert
LOG_TSUpdate
LOG_RowVersion
LOG_WFID
LOG_AdditionalMessage
LOG_ActionSucceeded
LOG_Duration
LOG_ActionType
LOG_TransactionType
LOG_ParentActionID
LOG_ShowOnlyInAdminMode
LOG_ACBID
LOG_Name
LOG_Description
LOG_SectionGuid
LOG_ASEID
LOG_ActionExecutionGuid
409
1022
187
495
1061

2
20-03-2025 19:26:15
20-03-2025 19:26:15
System.Byte[]
1021
Version: 3
FALSE
0
2
3

FALSE

Rollback after an error in automation

b33951bc-bf05-45e4-a8a8-abbb692210d9
309

408
1022
187
495
1061
69
0
20-03-2025 19:26:15
20-03-2025 19:26:15
System.Byte[]
1021
Error code: 100

Request Start

Request-Url:

https://link-to-url/api

Request-Header:





Request-Body:

[BINARY_CONTENT] 193145 bytes

Request End

Response Start

Response-Code:

BadRequest (400)

Response-Body:

{"error":"No file part"}


Response-Header:

Date: Thu, 20 Mar 2025 19:26:15 GMT

Server: gunicorn



Response End

Exceptions:

System.Exception: Rest service call failed. Http code BadRequest (400). Inspect log to get more information.



Other:



Version: 3
FALSE
65
2
0

FALSE

After Action Warning: Send to API PDF2Image
Send to API PDF2Image - Request Url:

https://link-to-url/api

Response Code:

BadRequest (400)

Exceptions:

Rest service call failed. Http code BadRequest (400). Inspect log to get more information.

b33951bc-bf05-45e4-a8a8-abbb692210d9
309

In reply to: Daniel Krüger (Cosmo Consult)

Hi,

I haven't succeeded in using the multipart body type either.
I documented my approaches here:
https://daniels-notes.de/posts/2024/importing-applications-using-an-application#uploading-package-with-standard-rest-action

In the end I created a custom action using the SDK:
https://daniels-notes.de/posts/2024/importing-applications-using-an-application#upload-the-package-and-configuration
https://github.com/Daniel-Krueger/webcon_application_import/blob/main/BPS%20Actions/BPS%20Actions/UploadPackageToImportSession.cs

If you want to compare the Postman and WEBCON request I would recommend to install a proxy like HTTP Toolkit to view the requests.
https://daniels-notes.de/posts/2022/debug-web-service-datasource

Best regards,
Daniel

Hey Daniel
Does it mean that Rest Web service action with attachments is useless? Have you tried to raise an bug with this action?
I see the workaround that you provide and it is amazing but it doesn't really solve the root cause of the issue.

MVP
In reply to: Dom Zuk

Hey Daniel
Does it mean that Rest Web service action with attachments is useless? Have you tried to raise an bug with this action?
I see the workaround that you provide and it is amazing but it doesn't really solve the root cause of the issue.

Hi Dom,

the Body type "binary" works just fine for uploading documents to SharePoint. The multi part is way more complex and caused me problems. One of those is, that I'm not really knowledgeable about it at all and the body may depend on the endpoint implementation.
I haven't created ticket at WEBCON because I wouldn't have time to follow up on it anyway. This was a private project which I wanted to complete. :)

Best regards,
Daniel

In reply to: Daniel Krüger (Cosmo Consult)

Hi Dom,

the Body type "binary" works just fine for uploading documents to SharePoint. The multi part is way more complex and caused me problems. One of those is, that I'm not really knowledgeable about it at all and the body may depend on the endpoint implementation.
I haven't created ticket at WEBCON because I wouldn't have time to follow up on it anyway. This was a private project which I wanted to complete. :)

Best regards,
Daniel

hey Daniel
Thanks for prompt reply. I aligned the HTTP request with your definition of body - interesingly I was able to produce different error.

"Error code: 100
Request Start
Request-Url:
URL/ENDPOINT
Request-Header:


Request-Body:
[BINARY_CONTENT] 193145 bytes
Request End
Response Start
Response-Code:
InternalServerError (500)
Response-Body:
{"error":"Cannot open empty file: filename='/tmp/dummy_it_services.pdf'."}

Response-Header:
Date: Wed, 26 Mar 2025 13:01:55 GMT
Server: gunicorn

Response End
Exceptions:
System.Exception: Rest service call failed. Http code InternalServerError (500). Inspect log to get more information.

Other:

Version: 3"

It looks like the file is not saved on the server. I tested it and after savign attachments I can produce different pdf from this. Have you ever faced this issue? Or you treated it as the same as your article and didn't invest more?

MVP
In reply to: Dom Zuk

hey Daniel
Thanks for prompt reply. I aligned the HTTP request with your definition of body - interesingly I was able to produce different error.

"Error code: 100
Request Start
Request-Url:
URL/ENDPOINT
Request-Header:


Request-Body:
[BINARY_CONTENT] 193145 bytes
Request End
Response Start
Response-Code:
InternalServerError (500)
Response-Body:
{"error":"Cannot open empty file: filename='/tmp/dummy_it_services.pdf'."}

Response-Header:
Date: Wed, 26 Mar 2025 13:01:55 GMT
Server: gunicorn

Response End
Exceptions:
System.Exception: Rest service call failed. Http code InternalServerError (500). Inspect log to get more information.

Other:

Version: 3"

It looks like the file is not saved on the server. I tested it and after savign attachments I can produce different pdf from this. Have you ever faced this issue? Or you treated it as the same as your article and didn't invest more?

Hi Dom,

I've also noticed that sometimes the latest data is not available for an action. Maybe the attachment is not yet committed to the database and therefore the action can not read it. Sometime it helps to move action from the OnPath trigger to the OnEntry of the next step.

I'm not sure whether I faced this specific issue. I try to remember where I have a case, in which an attachment is added by a user to a new instance which has not yet been saved. I don't think so. While attachment are automatically saved, if they are added to an existing instance, they are somehow temporarily saved for a new instance. On the one hand they need to be available/editable, also the instance is not yet saved /the WFD_ID is null. On the other hand they need to be deleted, if the user aborted the creation of the instance.



Best regards,
Daniel

Privacy overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognizing you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.


To see a full list of the cookies we use and learn more about their purposes, visit our Privacy Policy.