Forum Discussion

hananurrehman's avatar
hananurrehman
Occasional Visitor
4 years ago

Content-Length header already present error in soapUI 5.6.0

I am trying to run a REST API call on SoapUI version 5.6.0 and I'm getting the following error:

Thu Dec 24 19:34:18 PKT 2020:ERROR:org.apache.http.client.ClientProtocolException
org.apache.http.client.ClientProtocolException
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:839)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$Helper.execute(HttpClientSupport.java:233)
at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport.execute(HttpClientSupport.java:323)
at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.submitRequest(HttpClientRequestTransport.java:301)
at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:231)
at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:119)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: org.apache.http.ProtocolException: Content-Length header already present
at org.apache.http.protocol.RequestContent.process(RequestContent.java:97)
at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:133)
at org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:167)
at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$SoapUIHttpRequestExecutor.preProcess(HttpClientSupport.java:113)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:484)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835)

 

I am well aware of past fixes suggested for this, I have tried them all but to no avail.

I cannot run this API without the Content-length header as the server throws a 500 error

My key value pair is as follows:

Content-Length <calculated when request is sent> HEADER METHOD

 

 

4 Replies

  • richie's avatar
    richie
    Community Hero
    Hey hananurrehman,

    Are you saying your get two Content-Length headers in your request?

    Some headers are dynamically generated and the Content-Length is one of them. Have you tried removing the header youre manuallt adding in to see what happens?

    Ta

    Rich
  • Koepp's avatar
    Koepp
    Occasional Visitor

    Problem was with my settings, like I thought! Checking the "Authenciate Preemptively" check box in global HTTP settings solved the issue 🙂

     

     

     

     

     

     

    MyGroundBiz.com

    • richie's avatar
      richie
      Community Hero
      Hey Koepp,

      are you answering this or is this a separate issue or something else?

      Reason why i ask, what i got from hananurrehman's message was that there were 2 Content-Length headers being generated in hia request and i wouldnt expect hitting authenticate preemptively checkbox to fix that...??

      Ta

      Rich
      • markhell112's avatar
        markhell112
        New Member

        I got the error to go away (in SoapUI 4.5.1) by checking the Authenticate Preemptively flag in

        Preferences -> HTTP Settings -> Authenticate Preemptively

         

        Mygroundbiz