Ask a Question

REST Basic Authentication error at endpoint level

breaux
Contributor

REST Basic Authentication error at endpoint level

Version 5.2.1 on Windows

 

When I add my HTTP Basic Authentication to individual REST requests, it works fine with my service.

 

When I add the same username and password to my endpoint definition instead, I get an apache.httpclient.ClientProtocolException.

 

Here are the log excerpts (with host names obscured). Note the original project endpoint was localhost:9080 (without authentication required), and the new one with it required is what I'm showing as real-endpoint-server.

 

From SoapUI log:

 

Tue Dec 01 18:35:44 CST 2015:DEBUG:Loading Definition...
Tue Dec 01 18:35:44 CST 2015:INFO:Loading schema types from [http://localhost:9080.wadl]
Tue Dec 01 18:35:44 CST 2015:INFO:Getting schema http://localhost:9080.wadl
Tue Dec 01 18:35:44 CST 2015:DEBUG:Loaded Definition: ok
Tue Dec 01 18:36:12 CST 2015:DEBUG:Attempt 1 to execute request
Tue Dec 01 18:36:12 CST 2015:DEBUG:Sending request: GET /rbm/vehicle/my-item-number?vin=my-vin HTTP/1.1
Tue Dec 01 18:36:12 CST 2015:DEBUG:Receiving response: HTTP/1.1 401 Not authorized.  Authentication required for protected file.
Tue Dec 01 18:36:12 CST 2015:DEBUG:Connection can be kept alive indefinitely
Tue Dec 01 18:36:12 CST 2015:DEBUG:Target requested authentication
Tue Dec 01 18:36:12 CST 2015:DEBUG:Authorization challenge processed
Tue Dec 01 18:36:12 CST 2015:DEBUG:Authentication scope: BASIC 'Renew_by_Mail'@real-endpoint-server:443
Tue Dec 01 18:36:12 CST 2015:INFO:real-endpoint-server:443 requires authentication with the realm 'Renew_by_Mail'
Tue Dec 01 18:36:12 CST 2015:DEBUG:Found credentials
Tue Dec 01 18:36:12 CST 2015:DEBUG:Attempt 2 to execute request
Tue Dec 01 18:36:12 CST 2015:DEBUG:Sending request: GET /rbm/vehicle/my-item-number?vin=my-vin HTTP/1.1
Tue Dec 01 18:36:18 CST 2015:DEBUG:Connection closed
Tue Dec 01 18:36:18 CST 2015:DEBUG:Connection shut down
Tue Dec 01 18:36:18 CST 2015:ERROR:Exception in request: org.apache.http.client.ClientProtocolException
Tue Dec 01 18:36:18 CST 2015:ERROR:An error occurred [org.apache.http.client.ClientProtocolException], see error log for details
Tue Dec 01 18:36:18 CST 2015:INFO:Error getting response for [http://localhost:9080.vehicle:06975686]; org.apache.http.client.ClientProtocolException

 

From error log:

 

Tue Dec 01 18:36:18 CST 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.ProtocolException: The server failed to respond with a valid HTTP response
       at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:109)
       at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:252)
       at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:281)
       at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:247)
       at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:219)
       at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$SoapUIHttpRequestExecutor.doReceiveResponse(HttpClientSupport.java:147)
       at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
       at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:633)
       at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:454)
       at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
       ... 11 more

 

However, in http log, it does appear that a reasonable-looking reply was returned, along with a 200 response code. Which also matches my server's http log.

11 REPLIES 11
breaux
Contributor

Re: REST Basic Authentication error at endpoint level

No ideas, eh?
breaux
Contributor

Re: REST Basic Authentication error at endpoint level

Anyone? Should basic auth at the endpoint level propagate down to the resources, methods, requests?

nmrao
Community Hero

Re: REST Basic Authentication error at endpoint level

Unsure of the question. Would you please show the problem with screen shots or small video to reproduce it?


Regards,
Rao.
breaux
Contributor

Re: REST Basic Authentication error at endpoint level

If I set user/password here, at the endpoint level:

 

CaptureSoapUI1.PNG

It is not passed in the request underneath that. I have to manually then add it to the request itself:

CaptureSoapUI2.PNG

This is a lot of duplicated work and makes me think I'm doing something incorrect.

breaux
Contributor

Re: REST Basic Authentication error at endpoint level

Hmmm... I noticed when I went back to the endpoint that the password was blank again. After I eventually got it to "stick" (by hitting enter), now it seems the authentication is being passed down. I had also just recently "Assign"ed it to the endpoint, which I hadn't done before.

breaux
Contributor

Re: REST Basic Authentication error at endpoint level

Never mind. That was on a second REST project.

 

On the first, I still get:

"Error getting response; org.apache.http.client.ClientProtocolException"

 

if I remove the Basic Auth from the individual request and attempt to fall back to what's defined at the endpoint:

 

CaptureSoapUI3.PNG

 

 

CaptureSoapUI4.PNG

breaux
Contributor

Re: REST Basic Authentication error at endpoint level

Still having this problem with 5.3.0. Even with a brand new method under the resource which has endpoints that have basic authentication stored in them. If I don't add the Basic Auth to each message, it's apparently not passed.

 

I wonder if I should recreate the resources under the service?

breaux
Contributor

Re: REST Basic Authentication error at endpoint level

No, recreating the resource didn't change the behavior.

breaux
Contributor

Re: REST Basic Authentication error at endpoint level

Nor did recreating the entire Project and first adding the Basic Authentication before creating resources or requests 😞

cancel
Showing results for 
Search instead for 
Did you mean: