Hi,

Basically you can achieve your requirements by activation CXF logging feature 
(https://cxf.apache.org/docs/debugging-and-logging.html ) and WS-Addressing 
(https://cxf.apache.org/docs/ws-addressing.html ), which automatically adds 
message ID into SOAP header.

If you (for some reasons) would like to add own SOAP header with UUID you can 
do it in this way: 
http://cxf.apache.org/faq.html#FAQ-HowcanIaddsoapheaderstotherequest/response? 
Of course you will be able to fetch it in your interceptor as well.

Regards,
Andrei.


> -----Original Message-----
> From: arifnsu [mailto:[email protected]]
> Sent: Freitag, 7. Februar 2014 02:05
> To: [email protected]
> Subject: How to Forward additional content from Implementation class to
> outInterceptors
> 
> Hi All,
> I am new in Apache CXF technology.
> 
> Let me give a little background on my problem statement. I want to log my web
> service invocation steps as below.
> a. The input soap message (request payload) b. Implementation steps (My
> serivce specific steps) c. The output soap message (respone payload of my
> service
> 
> To achieve this, I have created inInterceptors  and outInterceptors classes 
> to log
> the soap request and resposne messages. And I am logging my service specific
> logs from my implementation class. All working fine.
> 
> But, as I want to maintain a unique ID concept to relate all the logs for each
> service invocation, I have created UUID in my inInterceptors and forwarded
> that UUID as a String with my SoapMessage as an additional content.
> @Override
>       public void handleMessage(SoapMessage message) throws Fault {  try
>         {
>             // now get the request xml
>             InputStream is = message.getContent ( InputStream.class );
>             CachedOutputStream os = new CachedOutputStream ( );
>             IOUtils.copy ( is, os );
>             os.flush ( );
>             message.setContent (  InputStream.class, os.getInputStream ( ) );
>             is.close ( );
>             UUID idOne = UUID.randomUUID();
>       UniqueIDInString = idOne.toString();
>              message.put("UniqueIDInString", UniqueIDInString);
>     os.close ( );
>         }
> 
>         catch ( Exception ex )
>         {
>             ex.printStackTrace ( );
>         }
> }
> 
> It works fine. I can fetch this UUID from my implementation class. But I am
> failing to forward that UUID  information from Implementation class to
> outInterceptors. It would be great if you could suggest me on how to forward
> that info towards outInterceptors. *I could not send it as part of soap 
> repsones
> message as well.*. Also, I do not want it to be in the soap response message 
> as
> this make my resposne invalid (Schema wise). It would good if you could
> suggest me how to remove this additional content, once I fetch the UUID
> content.
> 
> Let me know your suggestion. Thank you.
> 
> Regards,
> Arif
> 
> 
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/How-to-
> Forward-additional-content-from-Implementation-class-to-outInterceptors-
> tp5739649.html
> Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to