Forum Discussion

NJacobs's avatar
NJacobs
Occasional Contributor
10 years ago

REST-POST-application/octet-stream - ERROR:Exception in request...

In case I do REST http request POST, and I attach to the request an image file, I modified the content-type of the attachment to application/octet-stream and the Media Type of the request is also application/octet-stream.
see screenshot attached that illustrates the request
note that the request uses digest authentication as well 

I'm using SOAPUI 5.2.1

I get an ERROR:Exception in request: org.apache.http.client.ClientProtocolException
Wed Dec 09 11:20:14 CET 2015:ERROR:org.apache.http.client.ClientProtocolException
org.apache.http.client.ClientProtocolException
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:822)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
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:290)
at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:220)
at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:119)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity.
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:611)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:454)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
... 11 more

  • NJacobs's avatar
    NJacobs
    8 years ago

    Today I learned that enabling 'adds Expect-Continue header to outgoing request' in HTTP settings of SoapUI

    is the solution for the problem I initially reported.

     

    I hope this info helps other users that have the same problem.

  • nmrao's avatar
    nmrao
    Champion Level 3
    Mean to say, possible application defect, hoping nothing to do with soapUI.
    • NJacobs's avatar
      NJacobs
      Occasional Contributor

      Thank for answer.

      Meanwhile I analyzed the problem some more and came to the conclusion that the error is probably caused by a SoapUI bug.

       

      I think the error occurs because I use digest authentication in combination with a REST post request with a file attached.
      In this combination SoapUI doesn't retry after receiving the answer: 401 Unauthorized with the Digest realm and nonce values in the header

       

      In case I repeat my test, but instead of doing a REST post request with a file attached  (still using digest authentication)
      I don't attach the file, but I post the binary file INLINE, then I don't get the error anymore.
      However including the binary file inline give me other problems because SoapUI encodes the binary file as if it was text....

      Conclusion: I can't succussfully do  a REST post request with application/octet-stream    file in the body of the http-request
      in combination with digest authentication

      • nmrao's avatar
        nmrao
        Champion Level 3
        Ok, unfortunate. Do you find any other way of posting the same successfully?