Okay, adding cxf-rt-transports-http as a dependency solves the previous
exception. Now I'm sure I'm using CXF instead of the default JAX-WS comming
with Java 8. And the result has changed: I'm receiving:
org.apache.cxf.transport.http.HTTPException: HTTP response '401:
Unauthorized' when communicating with http://...
Here is the service response in TCP/IP Monitor (by the way the trick with
-Dhttp.ProxyHost ... worked):
HTTP/1.1 401 Unauthorized
Server: Apache-Coyote/1.1
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
WWW-Authenticate: Basic realm="Spring"
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 26 May 2016 16:00:41 GMT
a5
{"timestamp":1464278441332,"status":401,"error":"Unauthorized","message":"Full
authentication is required to access this
resource","path":"/api/ts/archivage/1.1/ws"}
0
And here is the request:
POST http://test.... HTTP/1.1
Content-Type: application/soap+xml; charset=UTF-8
Accept: */*
User-Agent: Apache CXF 2.4.5
Cache-Control: no-cache
Pragma: no-cache
Host: test.intrasie.lexisnexis.fr
Proxy-Connection: keep-alive
Content-Length: 259
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
...
</soap:Body>
</soap:Envelope>
The SoapUI request is as follows:
POST /ws HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/soap+xml;charset=UTF-8
Content-Length: 679
Host: localhost:9000
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
mlns:ts="http://ts_archivage.lnf.com/">
<soap:Header/>
<soap:Body>
...
</soap:Body>
</soap:Envelope>
POST /ws HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/soap+xml;charset=UTF-8
Content-Length: 679
Host: localhost:9000
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Authorization: Basic c2VjdXJlZDpmb28=
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:ts="http://ts_archivage.lnf.com/">
<soap:Header/>
<soap:Body>
...
</soap:Body>
</soap:Envelope>
and the SoapUI response:
HTTP/1.1 401 Unauthorized
Server: Apache-Coyote/1.1
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
WWW-Authenticate: Basic realm="Spring"
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 26 May 2016 15:49:52 GMT
90
{"timestamp":1464277792181,"status":401,"error":"Unauthorized","message":"Full
authentication is required to access this resource","path":"/ws"}
0
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-Application-Context: application:9001
Accept: application/soap+xml, text/html, image/gif, image/jpeg, *; q=.2,
*/*; q=.2
SOAPAction: ""
Content-Type: Multipart/Related;
boundary="----=_Part_4_135559848.1464277792196"; type="application/xop+xml";
start-info="application/soap+xml";charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 26 May 2016 15:49:52 GMT
1ff
------=_Part_4_135559848.1464277792196
Content-Type: application/xop+xml; charset=utf-8;
type="application/soap+xml"
<env:Envelope
xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Header/><env:Body>...</env:Body></env:Envelope>
------=_Part_4_135559848.1464277792196--
0
What seems to happen is that the authentication doesn't work in my unit test
calling the JAX-WS proxy. However, the following is setting the credentials:
bindingProvider.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
"bar");
bindingProvider.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
"foo");
What I'm doing wrong here ?
Many thanks in advance,
Nicolas
--
View this message in context:
http://cxf.547215.n5.nabble.com/com-sun-xml-internal-ws-client-ClientTransportException-The-server-sent-the-status-code-HTTP-406-Note-tp5768944p5768967.html
Sent from the cxf-user mailing list archive at Nabble.com.