Hi Sergey
=========================

Hi Tomasz

=============

> Hi Sergey,
>
> WebApplicationException comes from AbstractClient.readBody(), inside catch:
>
> MessageBodyReader mbr =
> ProviderFactory.getInstance(inMessage).createMessageBodyReader(
> try {
>   return mbr.readFrom(cls, type, anns, contentType, new MetadataMap<String,
> Object>(r.getMetadata(), true, true), conn.getInputStream());
> } catch (Exception ex) {
>   throw new WebApplicationException();
> }
>
> Few lines before is the status checked, in some cases (204) simply null is
> returned. So yes, client tries to read the body.
>
> I use CXF in cooperation with Spring, so I'm not sure, what exactly should
> I answer, so I will simply attach part o stacktrace:
> javax.ws.rs.WebApplicationException
>        at
> org.apache.cxf.jaxrs.client.AbstractClient.readBody(AbstractClient.java:391)
>        at
> org.apache.cxf.jaxrs.client.ClientProxyImpl.handleResponse(ClientProxyImpl.java:444)
>        at
> org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:428)
>        at
> org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:171)
>        at $Proxy88.update(Unknown Source)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
>        at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
>        at $Proxy95.update(Unknown Source)
> (lower in stacktrace is no important stuff)
>
> I tried the trick with IN interceptor and different phases, did not work...
> Which phase you think it should be? I tried to debug this, the status is
> taken from HttpURLConnection, can it be really overridden?
>
>
I'm fixing that right now, it's unfortunate HttpUrlConnection is used to
check the status there given that few lines earlier the status is taken from
the message. In 2.3.4 you'll be able to override the status.

The direct HttpUrlConnection dependency itself will be removed once the
async http conduit gets supported.

I think you can try the following at the moment. I can see the proxies are
injected from Spring, but the actual code where the invocations are made can
be handled like this:

@Resource
BookService proxy;


try {
   return proxy.getIt();
} catch (WebApplicationException ex) {
    Response response = WebClient.client(proxy).getResponse();
    if (response.getStatus() == 200) {
        return null;
    }
    throw ex;
}

Will it work for you ?

Sergey

===========================================================
Hi Sergey
Well, at least I know a cannot handle the problem the right way ;) Your 
workaround is not perfect, but maybe it will be the only solution. Will see.
Thank you very much for your such quick help!
Pozdrawiam :)

Tomasz

> Thanks
>
> ====
>
> Greets
> > Tomasz
> >
>

Capgemini Polska Sp. z o.o.,
ul. Piękna 18, 00-549 Warszawa
Sąd Rejonowy dla M.ST. Warszawy, XII Wydział Gospodarczy Rejestrowy, nr KRS: 
0000040605
NIP: 526-11-84-467,
wysokość kapitału zakładowego: 16 397 097,00 ZŁ






This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is 
intended only for the person to whom it is addressed. If you are not the 
intended recipient, you are not authorized to 
read, print, retain, copy, disseminate, distribute, or use this message or any 
part thereof. If you receive this message 
in error, please notify the sender immediately and delete all copies of this 
message.

Reply via email to