Indeed... Just tried a rapid POC-project and it worked ;)
Thanks a lot for this help! -----Message d'origine----- De : Freeman Fang [mailto:[email protected]] Envoyé : vendredi 22 avril 2011 12:32 À : [email protected] Objet : Re: How to retrieve a stream to the generated SOAP request On 2011-4-22, at 下午5:08, MARTELLI Julien wrote: > Very good idea, thanks a lot! > > As my project is an API that I deliver to customers in order for > them to integrate it in their various environments, I don't have > (and don't want to) access to the DB. > I will try to make a LoggingOutInterceptor-like solution that will > return an input stream to the message content. > Sounds kind of weird to me somehow... Cause I will work on > OutputStreams to extract a INputStream.... > What do you think? That is exactly what CachedOutputStream used in LoggingOutInterceptor can offer you, and that's why you need register callback which could get invoked when close the outputstream, so that at that time you can get inputstream as the outputstream writen is done, just use CachedOutputStream.getInputStream() method. And this way is also used somewhere else something like if you want to reread a Inputstream. Freeman > > -----Message d'origine----- > De : Freeman Fang [mailto:[email protected]] > Envoyé : vendredi 22 avril 2011 10:30 > À : [email protected] > Objet : Re: How to retrieve a stream to the generated SOAP request > > Hi, > > I think you can take a look at the cxf LoggingOutInterceptor, that > could be very similar with your requirement, the only difference is it > dump the message to console, you can dump the message to your > database. Basically it register a callback and when close > outputsteam, the callback is invoked to dump the message. > > Freeman > On 2011-4-22, at 下午4:08, MARTELLI Julien wrote: > >> Hi all, >> >> I am wondering how can I retrieve the content (ex : a stream) of the >> generated SOAP request on my CXF client. >> The idea is that our consumer needs to persist the generated SOAP >> request in database for tracing purpose. >> >> I am thinking of developping an interceptor binded to the proper >> phase to solve this. >> I have several questions regarding this : >> >> - Do you think this is a good idea ? Is there a better way >> to achieve this (maybe a CXF build-in functionnality ?) ? >> >> - Thinking of developping an interceptor I am wondering how >> to achieve this ? >> >> o The message seems to be completely written after the >> StaxOutEndingInterceptor execution >> >> o If I bind my interceptor just after this >> StaxOutEndingInterceptor will it be easy to get the message content ? >> >> Any help will be appreciated ! >> >> Thanks > > --------------------------------------------- > Freeman Fang > > FuseSource > Email:[email protected] > Web: fusesource.com > Twitter: freemanfang > Blog: http://freemanfang.blogspot.com > Connect at CamelOne May 24-26 > The Open Source Integration Conference > > > > > > > > --------------------------------------------- Freeman Fang FuseSource Email:[email protected] Web: fusesource.com Twitter: freemanfang Blog: http://freemanfang.blogspot.com Connect at CamelOne May 24-26 The Open Source Integration Conference
