Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Connect-REST GET method fails with Box API

SA-46443

Summary



User is on Pega 7.2 and reported seeing the below exception while trying to invoke Connect-REST Get method to get image files using Box API REST Service call.


Error Messages



com.pega.pegarules.pub.services.InboundMappingException: Could not write response entitiy to output stream
at com.pega.pegarules.integration.engine.internal.connect.http.HTTPClient.getResponseData(HTTPClient.java:890)
at com.pega.pegarules.integration.engine.internal.util.PRServiceUtils.getResponseData(PRServiceUtils.java:3200)
at com.pegarules.generated.activity.ra_action_pyinvokerestconnector_1df02d5a96ad215dc3e7350d2a9c98bf.step6_circum0(ra_action_pyinvokerestconnector_1df02d5a96ad215dc3e7350d2a9c98bf.java:1539)
at com.pegarules.generated.activity.ra_action_pyinvokerestconnector_1df02d5a96ad215dc3e7350d2a9c98bf.perform(ra_action_pyinvokerestconnector_1df02d5a96ad215dc3e7350d2a9c98bf.java:154)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3510)
at com.pegarules.generated.activity.ra_action_invoke_6a91441c4f6e5048b63360383ae1b952.step7_circum0(ra_action_invoke_6a91441c4f6e5048b63360383ae1b952.java:1002)
at com.pegarules.generated.activity.ra_action_invoke_6a91441c4f6e5048b63360383ae1b952.perform(ra_action_invoke_6a91441c4f6e5048b63360383ae1b952.java:172)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3510)
at com.pegarules.generated.activity.ra_action_getversions_84c1441832b9a2912ba3e18b60231d90.step4_circum0(ra_action_getversions_84c1441832b9a2912ba3e18b60231d90.java:358)
at com.pegarules.generated.activity.ra_action_getversions_84c1441832b9a2912ba3e18b60231d90.perform(ra_action_getversions_84c1441832b9a2912ba3e18b60231d90.java:104)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3510)
at com.pega.pegarules.session.internal.mgmt.Executable.invokeActivity(Executable.java:10587)
at com.pegarules.generated.activity.sh_action_getdocumenturlforeachversion_3d64b6c31b702f82d97ce4e264375d7d.step6_circum0(sh_action_getdocumenturlforeachversion_3d64b6c31b702f82d97ce4e264375d7d.java:439)
at com.pegarules.generated.activity.sh_action_getdocumenturlforeachversion_3d64b6c31b702f82d97ce4e264375d7d.perform(sh_action_getdocumenturlforeachversion_3d64b6c31b702f82d97ce4e264375d7d.java:154)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3510)
at com.pega.pegarules.session.internal.mgmt.Executable.doAction(Executable.java:3243)
at com.pegarules.generated.activity.ra_action_pyrunrecordexecute_0f739eeb61a9046be9a6d286a73f151a.step1_circum0(ra_action_pyrunrecordexecute_0f739eeb61a9046be9a6d286a73f151a.java:175)
at com.pegarules.generated.activity.ra_action_pyrunrecordexecute_0f739eeb61a9046be9a6d286a73f151a.perform(ra_action_pyrunrecordexecute_0f739eeb61a9046be9a6d286a73f151a.java:69)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3510)
at com.pega.pegarules.session.internal.mgmt.Executable.invokeActivity(Executable.java:10587)
at com.pegarules.generated.activity.ra_action_pzrunrecordexecute_f73998920c112079b42c8cca0a4e44ad.step11_circum0(ra_action_pzrunrecordexecute_f73998920c112079b42c8cca0a4e44ad.java:1009)
at com.pegarules.generated.activity.ra_action_pzrunrecordexecute_f73998920c112079b42c8cca0a4e44ad.perform(ra_action_pzrunrecordexecute_f73998920c112079b42c8cca0a4e44ad.java:245)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3510)
at com.pega.pegarules.session.internal.mgmt.base.ThreadRunner.runActivitiesAlt(ThreadRunner.java:646)
at com.pega.pegarules.session.internal.mgmt.PRThreadImpl.runActivitiesAlt(PRThreadImpl.java:466)
at com.pega.pegarules.session.internal.engineinterface.service.HttpAPI.runActivities(HttpAPI.java:3093)
at com.pega.pegarules.session.external.engineinterface.service.EngineAPI.processRequestInner(EngineAPI.java:390)
at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.performTargetActionWithLock(PRSessionProviderImpl.java:1277)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:1015)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:848)
at com.pega.pegarules.session.external.engineinterface.service.EngineAPI.processRequest(EngineAPI.java:331)
at com.pega.pegarules.session.internal.engineinterface.service.HttpAPI.invoke(HttpAPI.java:817)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl._invokeEngine_privact(EngineImpl.java:327)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl.invokeEngine(EngineImpl.java:270)
at com.pega.pegarules.session.internal.engineinterface.etier.ejb.EngineBean.invokeEngine(EngineBean.java:225)
at sun.reflect.GeneratedMethodAccessor77.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:370)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingThrowable(PRBootstrap.java:411)
at com.pega.pegarules.boot.internal.extbridge.AppServerBridgeToPega.invokeMethodPropagatingThrowable(AppServerBridgeToPega.java:224)
at com.pega.pegarules.boot.internal.extbridge.AppServerBridgeToPega.invokeMethodPropagatingException(AppServerBridgeToPega.java:246)
at com.pega.pegarules.internal.etier.ejb.EngineBeanBoot.invokeEngine(EngineBeanBoot.java:168)
at com.pega.pegarules.internal.etier.interfaces.EJSLocalStatelessEngineBMT_f2439d86.invokeEngine(Unknown Source)
at com.pega.pegarules.priv.context.JNDIEnvironment.invokeEngineInner(JNDIEnvironment.java:278)
at com.pega.pegarules.priv.context.JNDIEnvironment.invokeEngine(JNDIEnvironment.java:223)
at com.pega.pegarules.web.impl.WebStandardImpl.makeEtierRequest(WebStandardImpl.java:574)
at com.pega.pegarules.web.impl.WebStandardImpl.doPost(WebStandardImpl.java:374)
at sun.reflect.GeneratedMethodAccessor105.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:370)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingThrowable(PRBootstrap.java:411)
at com.pega.pegarules.boot.internal.extbridge.AppServerBridgeToPega.invokeMethodPropagatingThrowable(AppServerBridgeToPega.java:224)
at com.pega.pegarules.boot.internal.extbridge.AppServerBridgeToPega.invokeMethod(AppServerBridgeToPega.java:273)
at com.pega.pegarules.internal.web.servlet.WebStandardBoot.doPost(WebStandardBoot.java:121)
at com.pega.pegarules.internal.web.servlet.WebStandardBoot.doGet(WebStandardBoot.java:92)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1232)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:781)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:480)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1114)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3926)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1007)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:88)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881)
Caused by:
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:124)
at com.ibm.jsse2.c.a(c.java:35)
at com.ibm.jsse2.c.a(c.java:114)
at com.ibm.jsse2.SSLSocketImpl.a(SSLSocketImpl.java:239)
at com.ibm.jsse2.SSLSocketImpl.a(SSLSocketImpl.java:477)
at com.ibm.jsse2.g.read(g.java:22)
at com.pega.apache.http.impl.io.AbstractSessionInputBuffer.read(AbstractSessionInputBuffer.java:187)
at com.pega.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:176)
at com.pega.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:197)
at com.pega.apache.http.impl.io.ContentLengthInputStream.close(ContentLengthInputStream.java:105)
at com.pega.apache.http.entity.BasicHttpEntity.writeTo(BasicHttpEntity.java:117)
at com.pega.apache.http.entity.HttpEntityWrapper.writeTo(HttpEntityWrapper.java:96)
at com.pega.apache.http.conn.BasicManagedEntity.writeTo(BasicManagedEntity.java:114)
at com.pega.pegarules.integration.engine.internal.connect.http.HTTPClient.getResponseData(HTTPClient.java:887)
... 83 more


Steps to Reproduce

  1. Configure Connect-REST using GET method to get image file from Box REST Service.
  2. Invoke the Connect-REST using an activity.
  3. Notice Pega throws the "InboundMappingException" error while downloading of the image file from Box.


Root Cause



An issue in the custom application code or rules is identified as root cause.

The configured Connect-REST rule had plus ("+") characters in the Resource path and the property to map the response body was missing.

Pega will generate the appropriate endpoint URL if the Resource Parameter and Query String Parameter are configured on the Connect-REST rule form.

Also, if Pega receives a HTTP 302 response code then it means a Server Redirection. The Apache HTTP client does the redirection by default and Pega will receive the actual response body if the redirection is successful.

There is no need of mapping the redirection URL sent in the HTTP response header as Apache HTTP client will perform the direction and on Pega side the binary content will be mapped to the property configured in the response body.

Resolution



Perform the following local-change:
  1. Navigate to Method tab >Get >Response>Message data section and configure the Property to map the binary response content received in the response body from the REST Service.
  2. Remove the Plus ("+") characters from the Resource Path.
    For example: If the endpoint URL is expected to like "https://api.box.com/2.0/files/{FileID}/content?version={VersionID}", then in the Connect-REST rule; set the Resource Path as "https://api.box.com/2.0/files/{FileID}/content", configure FileID as the Resource parameter and configure versionID as the query string parameter.
Suggest Edit

Published March 21, 2018 - Updated October 8, 2020

Did you find this content helpful? Yes No

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us