Hello,
I must be missing something fundumental about in/out interceptor chains,
because here's what's happening:
- this is about the client (making a call) code
- I register interceptors like this:
client.getInInterceptors().add(new LoggingInInterceptor());
client.getOutInterceptors().add(new LoggingOutInterceptor());
PersistOutInterceptor persistOut = new PersistOutInterceptor();
persistOut.setExchangeDataDAO(<custom ExchangeDataDAO impl>);
client.getOutInterceptors().add(persistOut);
client.getInInterceptors().add(new PersistInInterceptor());
- when I make the call, I see that
PersistOutInterceptor::handleMessage() is invoked first - which makes
sense, I'm making an outgoing call, so first a message needs to go out.
However, the first line of code in that method is
ExchangeData exchangeData =
message.getExchange().getInMessage().getContent(ExchangeData.class);
This throws NPE b/c getInMessage() returns null. And it sort of makes
sense that it's null - there's no "in" message (aka response) yet -
we're still trying to make the call.
So why does PersistOutInterceptor look for the *in* message? What am I
missing in this very simple setup?
Thanks!
--Ernest
-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]]
Sent: Thursday, July 15, 2010 5:13 PM
To: [email protected]
Subject: Re: Persisting outgoing reqs interceptor
Hi
PersistIn/OutInterceptors were contributed too,
http://svn.apache.org/repos/asf/cxf/trunk/rt/management/src/main/java/or
g/apache/cxf/management/interceptor/
for example,
http://svn.apache.org/repos/asf/cxf/trunk/rt/management/src/main/java/or
g/apache/cxf/management/persistence/FilesystemExchangeDataDAO.java
can be used to persist data to the file, similarly the data can be saved
to the db storage, etc
not sure if it is exactly what is needed...
cheers, Sergey
--------------------------------------------------------
The information contained in this message is intended only for the recipient,
and may be a confidential attorney-client communication or may otherwise be
privileged and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent responsible
for delivering this message to the intended recipient, please be aware that any
dissemination or copying of this communication is strictly prohibited. If you
have received this communication in error, please immediately notify us by
replying to the message and deleting it from your computer. The McGraw-Hill
Companies, Inc. reserves the right, subject to applicable local law, to monitor
and review the content of any electronic message or information sent to or from
McGraw-Hill employee e-mail addresses without informing the sender or recipient
of the message.
--------------------------------------------------------