Question
Capgemini
US
Last activity: 26 Sep 2019 1:07 EDT
Getting Fail: Unexpected HTTP 500 Response code using the REST connector and setting values on pyRequestAttachmentPage
Hi,
I'm trying to send an attachment via connect-rest. Followed few articles and set the necessary propeties in header as well as the pyRequestAttachmentPage.
But every time i'm getting Fail: Unexpected HTTP 500 Response code error.
Can someone help please.
Thanks,
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Capgemini
US
Just for additional info. I'm working on 8.2.2 version.
I have followed the below steps as posted by one of the community member.
We have implemented the same using multipart form data and type binary. We used the Pega default feature to add an attachment to work object. We created a button in actions tab configured event on click to perform the following in sequence, calling Local Action pyAttachContent, Set Value of .pyAttachmentType to "File", Calling an activity , Refreshing the harness.
In the activity we are calling the OOTB activity AttachFile and in the next step we are calling the connect rest activity.
1)pyAttachNames(n) [This contains the parameter to be passed eg. name, file etc.];
2)pyAttachTypes(n) [This contains the content-type eg. application/json etc. ]. This should NOT be set to "multipart/formdata"
3)pyAttachValues(n) [This contains the binary data of the file to be passed] the value is SampleFile.pyAttachStream,
4)pyAttachFileNames(n) [This contains the entire file name with extension] the value is SampleFile.pxAttachName
We call the Connect rest with this page in clipboard and the file gets send along with the request.
Pegasystems Inc.
IN
Hi,
Do you get the same error if you test the same through soap UI or postman?
Could you please send us pegaRules.log after enabling debug mode for the below class.
com.pega.pegarules.integration.engine.internal.connect.rest.RESTConnector
Thank You,
Capgemini
US
Hi Dasn,
No I don't get any error in Postman, It is working fine. Please find the attached logs after enabling the debug mode for om.pega.pegarules.integration.engine.internal.connect.rest.RESTConnector.
Attached the logs.
Pegasystems Inc.
IN
Hi,
From the log , I could see
REST.xxxDocuments.UploadDocuments xxxx - Setting header "Content-Type" to configured value "appication/form-data" .Is it possible to download the log from server and provide us, from this log I did not find much.
Thank You,
Capgemini
US
So Content-Type should be set to different value not appication/form-data?
Attaching the full log. It might have other errors/exception. Issue i'm facing is with connect-rest (UploadDocuments)
Thank You,
Pegasystems Inc.
IN
Hi,
From the log I can see content type appication/form-data, please verify in the configuration if it application or appication (L is missing here).
If possible , please check with the rest service team to compare the request when you simulate it through Postman and when the request is through Pega connect rest.
Thank you,
Capgemini
US
Thanks dasn1 for your time. There was issue from the service team. And they have fxed it.
Thank You
Accepted Solution
Capgemini
US
Just for additional info. I'm working on 8.2.2 version.
I have followed the below steps as posted by one of the community member.
We have implemented the same using multipart form data and type binary. We used the Pega default feature to add an attachment to work object. We created a button in actions tab configured event on click to perform the following in sequence, calling Local Action pyAttachContent, Set Value of .pyAttachmentType to "File", Calling an activity , Refreshing the harness.
In the activity we are calling the OOTB activity AttachFile and in the next step we are calling the connect rest activity.
1)pyAttachNames(n) [This contains the parameter to be passed eg. name, file etc.];
2)pyAttachTypes(n) [This contains the content-type eg. application/json etc. ]. This should NOT be set to "multipart/formdata"
3)pyAttachValues(n) [This contains the binary data of the file to be passed] the value is SampleFile.pyAttachStream,
4)pyAttachFileNames(n) [This contains the entire file name with extension] the value is SampleFile.pxAttachName
We call the Connect rest with this page in clipboard and the file gets send along with the request.
Pegasystems Inc.
IN
Thank you sharing the details of your solution. We will mark this post - Answered.