POST to 3rd party REST Service with no request payload fails with HTTP 411 / Length Required / Content-Length is missing
(Doc ID 2550055.1)
Last updated on MAY 19, 2020
Applies to:
Oracle Integration-OIC - Version 18.2.5 and laterInformation in this document applies to any platform.
Goal
When using the REST Adapter to POST to a 3rd party service which does not require a request payload, the REST service responds with a HTTP 411 / Length Required / Content-Length is missing error response.
<nsmpr2:errorCode>{http://schemas.oracle.com/bpel/extension}remoteFault</nsmpr2:errorCode>
<nsmpr2:errorReason>ICS runtime execution error</nsmpr2:errorReason>
<nsmpr2:errorDetail>oracle.tip.adapter.sa.api.JCABindingException:Fault Details :
<ns2:APIInvocationError
xmlns:ns2="http://xmlns.oracle.com/cloud/generic/rest/fault/REST/XXXX">
<ns2:type/><ns2:title/><ns2:detail/><ns2:errorCode/>
<ns2:errorDetails>
<ns2:type>http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.12</ns2:type>
<ns2:title>Length Required</ns2:title>
<ns2:errorCode>411</ns2:errorCode>
<ns2:errorPath><![CDATA[POST https://<host:port>/<rest service> returned a response status of 411 Length Required]]> </ns2:errorPath>
<ns2:instance><![CDATA[{"fault":{"faultstring":"Content-Length is missing","detail":{"errorcode":"messaging.adaptors.http.flow.LengthRequired"}} }.The HyperText Transfer Protocol (HTTP) 411 Length Required client error response code indicates that the server refuses to accept the request without a defined Content-Length header. This is a common condition with POST calls especially when the target service expects an explicit content-length header in the request. To fix this error or force a content-length header, set EnfoceEmptyJSONObjectPayload connectivityProperty from the OIC mapper preceding the REST adapter invoke configuration. ]]>
</ns2:instance>
</ns2:errorDetails>
</ns2:APIInvocationError>:Application Errorexecute
</nsmpr2:errorDetail>
<nsmpr2:errorReason>ICS runtime execution error</nsmpr2:errorReason>
<nsmpr2:errorDetail>oracle.tip.adapter.sa.api.JCABindingException:Fault Details :
<ns2:APIInvocationError
xmlns:ns2="http://xmlns.oracle.com/cloud/generic/rest/fault/REST/XXXX">
<ns2:type/><ns2:title/><ns2:detail/><ns2:errorCode/>
<ns2:errorDetails>
<ns2:type>http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.12</ns2:type>
<ns2:title>Length Required</ns2:title>
<ns2:errorCode>411</ns2:errorCode>
<ns2:errorPath><![CDATA[POST https://<host:port>/<rest service> returned a response status of 411 Length Required]]> </ns2:errorPath>
<ns2:instance><![CDATA[{"fault":{"faultstring":"Content-Length is missing","detail":{"errorcode":"messaging.adaptors.http.flow.LengthRequired"}} }.The HyperText Transfer Protocol (HTTP) 411 Length Required client error response code indicates that the server refuses to accept the request without a defined Content-Length header. This is a common condition with POST calls especially when the target service expects an explicit content-length header in the request. To fix this error or force a content-length header, set EnfoceEmptyJSONObjectPayload connectivityProperty from the OIC mapper preceding the REST adapter invoke configuration. ]]>
</ns2:instance>
</ns2:errorDetails>
</ns2:APIInvocationError>:Application Errorexecute
</nsmpr2:errorDetail>
How can this be resolved when the Content-Length HTTP header is grayed out, and cannot be selected in the REST Adapter Wizard ?
Solution
To view full details, sign in with your My Oracle Support account. |
|
Don't have a My Oracle Support account? Click to get started! |
In this Document
Goal |
Solution |
References |