Hi All,
I'm facing this strange problem where URL generated by client appears to be
wrong. This is what is happening.
I have a Maven Test class which has around 7 test cases. First test always
passes rest all fail. For every test it sends 2 rest requests, first
request without "Authorization" header, when server responds saying "401
Unauthorized", second request with "Authorization" header.
(I'm skipping request that contains Authorization header here in below e.g.)
here base URL is: "http://localhost:8080/api-ws/ws/rs/v1" and method that is
invoked has part "/ci/COMPANY/2222"
I seems that it generates correct URL for first test wrong ones for rest
of them. So e.g.
1. First Test generated URL:
GET /api-ws/ws/rs/v1/ci/COMPANY/2222 HTTP/1.1
Content-Type: application/xml
Accept: application/csv
User-Agent: Apache CXF 3.0.2
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:8080
Connection: keep-alive
2. Second:
GET /api-ws/ws/rs/v1/ci/COMPANY/2222/ci/ACTION/invalid! HTTP/1.1
Content-Type: application/xml
Accept: application/csv
User-Agent: Apache CXF 3.0.2
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:8080
Connection: keep-alive
and so on...
for last test:
GET
/api-ws/ws/rs/v1/ci/COMPANY/2222/ci/ACTION/invalid!/ci/ACTION/1111/ci/COMPANY/%20%20%201111/ci/invalid!/2222/ci/ACTION/%20%20%20
HTTP/1.1
Content-Type: application/xml
Accept: application/csv
User-Agent: Apache CXF 3.0.2
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:8080
Connection: keep-alive
When I debug through cxf client (3.0.2) source, I found that class
"org.apache.cxf.transport.http.HTTPConduit" sets property
"transport.retransmit.url" on outMessage in method retransmit().
After second successful request call, class
"org.apache.cxf.jaxrs.client.AbstractClient" changes baseURL in method
completeExchange() after looking at "transport.retransmit.url" in outMessage
from "http://localhost:8080/api-ws/ws/rs/v1" to
"http://localhost:8080/api-ws/ws/rs/v1/ci/COMPANY/2222" and hence second
test fails.. as it tries to call baseURL + "/ci/ACTION/invalid!" i.e.
"http://localhost:8080/api-ws/ws/rs/v1/ci/COMPANY/2222/ci/ACTION/invalid!"
which obviously isn't correct.
I saw conversation between Daniel Sergey at
http://irclogs.dankulp.com/logs/irclogger_log/cxf/?date=2013-10-01,Tue뗬=on
but couldn't understand much. Can Daniel/Sergey please have a look to see
what I may be missing?
- psd
I'm facing this strange problem where URL generated by client appears to be
wrong. This is what is happening.
I have a Maven Test class which has around 7 test cases. First test always
passes rest all fail. For every test it sends 2 rest requests, first
request without "Authorization" header, when server responds saying "401
Unauthorized", second request with "Authorization" header.
(I'm skipping request that contains Authorization header here in below e.g.)
here base URL is: "http://localhost:8080/api-ws/ws/rs/v1" and method that is
invoked has part "/ci/COMPANY/2222"
I seems that it generates correct URL for first test wrong ones for rest
of them. So e.g.
1. First Test generated URL:
GET /api-ws/ws/rs/v1/ci/COMPANY/2222 HTTP/1.1
Content-Type: application/xml
Accept: application/csv
User-Agent: Apache CXF 3.0.2
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:8080
Connection: keep-alive
2. Second:
GET /api-ws/ws/rs/v1/ci/COMPANY/2222/ci/ACTION/invalid! HTTP/1.1
Content-Type: application/xml
Accept: application/csv
User-Agent: Apache CXF 3.0.2
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:8080
Connection: keep-alive
and so on...
for last test:
GET
/api-ws/ws/rs/v1/ci/COMPANY/2222/ci/ACTION/invalid!/ci/ACTION/1111/ci/COMPANY/%20%20%201111/ci/invalid!/2222/ci/ACTION/%20%20%20
HTTP/1.1
Content-Type: application/xml
Accept: application/csv
User-Agent: Apache CXF 3.0.2
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:8080
Connection: keep-alive
When I debug through cxf client (3.0.2) source, I found that class
"org.apache.cxf.transport.http.HTTPConduit" sets property
"transport.retransmit.url" on outMessage in method retransmit().
After second successful request call, class
"org.apache.cxf.jaxrs.client.AbstractClient" changes baseURL in method
completeExchange() after looking at "transport.retransmit.url" in outMessage
from "http://localhost:8080/api-ws/ws/rs/v1" to
"http://localhost:8080/api-ws/ws/rs/v1/ci/COMPANY/2222" and hence second
test fails.. as it tries to call baseURL + "/ci/ACTION/invalid!" i.e.
"http://localhost:8080/api-ws/ws/rs/v1/ci/COMPANY/2222/ci/ACTION/invalid!"
which obviously isn't correct.
I saw conversation between Daniel Sergey at
http://irclogs.dankulp.com/logs/irclogger_log/cxf/?date=2013-10-01,Tue뗬=on
but couldn't understand much. Can Daniel/Sergey please have a look to see
what I may be missing?
- psd