Integration

Get Involved. Join the Conversation.

Topic

    Simon
    EnforceEmptyJSONObjectPayload not workingAnswered
    Topic posted November 5, 2019 by Simon Green Ribbon: 100+ Points, tagged API, Cloud, Eloqua, Integration, REST 
    21 Views, 6 Comments
    Title:
    EnforceEmptyJSONObjectPayload not working
    Summary:
    HTTP POST without payload requires Content-Length header to be passed with value 0. OIC doesn't do that by default, and suggests using the EnforceEmptyJSONObjectPayload parameter to enforce that.
    Content:

    Trying to do an HTTP POST from OIC for which I'm not supposed to pass any payload. Target server however requires a Content-Length header to be passed with value 0 in that case, which OIC doesn't do by default.

    The error message I'm getting suggests to set EnforceEmptyJSONObjectPayload in the ConnectivityProperties for this REST call, but that doesn't seem to work. Tried setting it to true, but I keep on getting the same error message.

    Feels like a bug, but maybe I'm missing something. Any help/suggestions would be appreciated.

    Best Comment

    Hemanth Lakkaraju

    Check this for what the parameter does!

    Comment

     

    • Hemanth Lakkaraju

      Can you provide more information on the REST API you are using, adapter configuration and the exact error please?

      • Simon

        I'm using OIC's standard REST adapter. It's configured to do a POST to an Eloqua service, no headers configured, no request or response payload. It's really only the url, with one template parameter. In the mapping preceding the REST adapter I'm only mapping that template parameter, and setting the EnforceEmptyJSONObjectPayload parameter to true, as suggested in the error below.

        To be complete, this is the end point to which I'm posting: https://secure.p06.eloqua.com/API/REST/2.0/system/scheduledTask/import/queue/3

        The exact error: Eloqua is returning an HTTP 411 error: Length Required. HTTP Error 411. The request must be chunked or have a content length.

        In OIC this results in following error being displayed: 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 EnforceEmptyJSONObjectPayload connectivityProperty from the OIC mapper preceding the REST adapter invoke config.

        • Hemanth Lakkaraju

          Ok. Try adding an empty JSON in request mapping for the adapter and then set the EnforceEmptyJSONObjectPayload to true and see if it works.

          • Simon

            That's sort of what I did in the end. Empty JSON, and then also created the target node with empty string in the mapping. Don't even need the EnforceEmptyJSONObjectPayload parameter in that case, so it's not really clear to me what the parameter is for, and how it should be used.

            • Hemanth Lakkaraju

              Check this for what the parameter does!

              • Simon

                Right. Already read that earlier today, but didn't read it properly I think. It's only influencing what OIC does with the response coming from the REST service which is being invoked, doesn't have an effect on the request so it seems.