Support Article
java.net.SocketException: Connection reset by peer
SA-58175
Summary
REST Service is configured and a file is passed as a parameter. The file is uploaded to a binary rule and the value of the file parameter is set with the file source property of the Pega binary file. However, the REST Service does not provide any response.
Error Messages
** Caught unhandled exception: java.lang.RuntimeException: java.net.SocketException: Connection reset by peer: socket write error.
Steps to Reproduce
- Pass a multipart input to a REST Service.
- Create an activity.
- Invoke the REST Connector from the activity.
Root Cause
The REST Service Configuration and Activity Property-SET to pass the multipart input was configured incorrectly.
Resolution
Perform the following local-change:
- Perform a Property-SET with the below parameters before invoking the REST Connector in the activity.
.pyAttachNames(1) – “file” (as expected in the external Service API)
.pyAttachFileNames(1) - “File Name”
.pyAttachTypes(1) – “multipart/form-data”
.pyAttachValues(1) – fetchFile.pyFileSource
- Configure the POST method of the REST Service and add the appropriate headers and parameters. To pass any String parameters in the REST Service request body, perform the same in the Property-SET by adding .pyAttachNames (index).
- Set the form parameters as .pyAttachNames (index). Correspondingly, set .pyAttachValues (index) equal to the BASE 64 encoded value of the form paramter value.
For example,
.pyAttachNames(2) - "type"
.pyAttachValues(2) - if the value is "pdf", set this property to BASE 64 encoded value for "pdf".
- Map the Response to an equivalent property.
Published August 29, 2018 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.