You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by doshi_milan <md...@powercatalyst.com> on 2008/11/12 19:49:01 UTC

Retrieving SOAP Header and SOAP Body using Interceptors

I am using CXF within Servicemix. 

I want to know how would I be able to intercept XML request / response
within my code ? I have  created a user defined interceptor which extends
from  org.apache.cxf.interceptor.LoggingInInterceptor and similarly another
use defined Intercepor which extends from
org.apache.cxf.interceptor.LoggingOutInterceptor. I have this in the
xbean.xml file as follows :


        
          
        
        
			
		
		
			
		
		
		
I am able to override the handleMessage method. I know that
LoggingInInterceptor can directly log the XML but what I want is to retrieve
certain values etc within the interceptor. Thus for now, I want to see how
can I retrieve the ENTIRE message within the interceptor. This should be
very easy as the logging method probably does it but it is not available to
us. I failed to get any sample or documentation. I do not even know if 
LoggingInInterceptor /LoggingOutInterceptor are thr right interceptors to be
used.

Any help will be much appreciated.

Thanks!
Milan Doshi
-- 
View this message in context: http://www.nabble.com/Retrieving-SOAP-Header-and-SOAP-Body-using-Interceptors-tp20466758p20466758.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Re: Retrieving SOAP Header and SOAP Body using Interceptors

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

You need specify useJBIWrapper="false" for both your cxf bc and se to 
enable soap message pass into your cxf se.
Freeman

doshi_milan wrote:
> One important info. I have my Interceptors in cxf se. IS that an issue ? I
> mean, is it prohibiting me from capturing SOAP messages ?
>
>
> doshi_milan wrote:
>   
>> I guess I may have mixed up too many things in the same posting chain
>> above. Let me try to put it this way.The flow is very much what you have
>> put forth .
>> Client <=> cxf bc  <=> cxf se .
>>
>> I just want to capture the request / response XML for :
>> All requests that have failed (for any reasons (application or system
>> exceptions)). The idea is to divert the failed  requests to another
>> application.
>>
>> Thus with this in mind, all I want to achieve is capture the ORIGINAL SOAP
>> request (and also the response XML as it will have the error details).
>>
>> Summing up whatever I have already done :
>>    1. I have a user defined Interceptor that extends from
>> org.apache.cxf.interceptor.LoggingOutInterceptor.
>>    2. I override the handleMessage(org.apache.cxf.message.Message message)
>> method.
>>    3. I invoke this interceptor ONLY in case of error's fault. (I.e I
>> achieve this by the following entry within my xbean.xml)
>>                 <cxfse:inFaultInterceptors> 
>> 			<bean
>> class="com.powercatalyst.ods.osl.interceptor.OdsFaultInterceptor"/>
>> 		</cxfse:inFaultInterceptors>
>>    
>>
>> What I have achieved :
>> I am able to capture the request that is jbi based.
>>
>> What I really want to capture is a SOAP request.
>>  
>>  1. Do I need to make any change in xbean.xml to use any of the
>>      SOAPInterceptor ?
>>  2. Which interceptor should I use ?
>>  3. When I did try some, it gave me an error saying JBIMessage cannot be
>>      converted to SOAP etc
>>
>> I hope this gives more insight to my issue. Thanks for your time and help!
>>
>> Regards,
>> Milan
>>
>>
>>
>> Freeman Fang wrote:
>>     
>>> Hi Milan,
>>>
>>> I'm not sure I follow your question.
>>> Would you please describe more details about your scenario?
>>> Some thing like your work flow, e.g.
>>>
>>> external client <=(1)==> cxf bc <==(2)==> cxf se,
>>> and at which point you want to dump your soap message? The incoming 
>>> message or /outgoing message?
>>> Since the answer could be different depends on what's your real question
>>> is.
>>> Freeman
>>>
>>> doshi_milan wrote:
>>>       
>>>> Well, first of all thanks for the reply.... Not sure if I interpret your
>>>> answer.
>>>>
>>>> I mean, even I know that a SOAP Interceptor is required.
>>>>
>>>> So, my question is :
>>>>
>>>> 1. Do I need to make any change in xbean.xml to sue any of the
>>>> SOAPInterceptor ?
>>>> 2. Which interceptor should I use ?
>>>> 3. When I did try some, it gave me an error saying JBIMessage cannot be
>>>> converted to SOAP etc
>>>> 4. How do I actually 'Retrieve' XML data from the SOAP env? I mean the
>>>> code.
>>>>
>>>> Your elaborate answer will help me a lot!
>>>>
>>>> Thanks,
>>>> Milan
>>>>
>>>>
>>>> Freeman Fang wrote:
>>>>   
>>>>         
>>>>> Hi,
>>>>> The message inside servicemix container is JBI style message, which 
>>>>> means the message with JBI wrapper.
>>>>> If you want to capture the soap xml request, you need add similar 
>>>>> interceptors for cxf bc endpoint.
>>>>>
>>>>> Freeman
>>>>>
>>>>> doshi_milan wrote:
>>>>>     
>>>>>           
>>>>>> Thanks for the reply. But I do have an issue. Actually I am supposed
>>>>>> to
>>>>>> capture the SOAP XML request and it seems that the request that I
>>>>>> capture
>>>>>> is
>>>>>> NOT really a SOAP request.
>>>>>>
>>>>>> Hence , it seems that there is a major change in the Interceptors that
>>>>>> I
>>>>>> am
>>>>>> using. I guess I should be using SOAP interceptors... Can I know which
>>>>>> interceptor should I be using and more importantly how do I get SOAP
>>>>>> REQUEST
>>>>>> / RESPONSE XML message instead of a jbi message ?
>>>>>>
>>>>>> Is this how I should be defining my XBean ? 
>>>>>>
>>>>>>  <cxfse:endpoint  useJBIWrapper="false"  >
>>>>>>         <cxfse:pojo>
>>>>>>           <bean
>>>>>> class="com.powercatalyst.ods.osl.pricedata.OdsPriceDataImpl"
>>>>>> />
>>>>>>         </cxfse:pojo>
>>>>>>        : :
>>>>>>
>>>>>> I need to be able to retrieve the request XML from the SOAP
>>>>>> Interceptor.
>>>>>> I
>>>>>> would appreciate if that is also stated to me.
>>>>>>
>>>>>> Thanks and regards,
>>>>>> Milan
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>       
>>>>>>             
>>>>   
>>>>         
>>>
>>>       
>>     
>
>   


Re: Retrieving SOAP Header and SOAP Body using Interceptors

Posted by doshi_milan <md...@powercatalyst.com>.
One important info. I have my Interceptors in cxf se. IS that an issue ? I
mean, is it prohibiting me from capturing SOAP messages ?


doshi_milan wrote:
> 
> I guess I may have mixed up too many things in the same posting chain
> above. Let me try to put it this way.The flow is very much what you have
> put forth .
> Client <=> cxf bc  <=> cxf se .
> 
> I just want to capture the request / response XML for :
> All requests that have failed (for any reasons (application or system
> exceptions)). The idea is to divert the failed  requests to another
> application.
> 
> Thus with this in mind, all I want to achieve is capture the ORIGINAL SOAP
> request (and also the response XML as it will have the error details).
> 
> Summing up whatever I have already done :
>    1. I have a user defined Interceptor that extends from
> org.apache.cxf.interceptor.LoggingOutInterceptor.
>    2. I override the handleMessage(org.apache.cxf.message.Message message)
> method.
>    3. I invoke this interceptor ONLY in case of error's fault. (I.e I
> achieve this by the following entry within my xbean.xml)
>                 <cxfse:inFaultInterceptors> 
> 			<bean
> class="com.powercatalyst.ods.osl.interceptor.OdsFaultInterceptor"/>
> 		</cxfse:inFaultInterceptors>
>    
> 
> What I have achieved :
> I am able to capture the request that is jbi based.
> 
> What I really want to capture is a SOAP request.
>  
>  1. Do I need to make any change in xbean.xml to use any of the
>      SOAPInterceptor ?
>  2. Which interceptor should I use ?
>  3. When I did try some, it gave me an error saying JBIMessage cannot be
>      converted to SOAP etc
> 
> I hope this gives more insight to my issue. Thanks for your time and help!
> 
> Regards,
> Milan
> 
> 
> 
> Freeman Fang wrote:
>> 
>> Hi Milan,
>> 
>> I'm not sure I follow your question.
>> Would you please describe more details about your scenario?
>> Some thing like your work flow, e.g.
>> 
>> external client <=(1)==> cxf bc <==(2)==> cxf se,
>> and at which point you want to dump your soap message? The incoming 
>> message or /outgoing message?
>> Since the answer could be different depends on what's your real question
>> is.
>> Freeman
>> 
>> doshi_milan wrote:
>>> Well, first of all thanks for the reply.... Not sure if I interpret your
>>> answer.
>>>
>>> I mean, even I know that a SOAP Interceptor is required.
>>>
>>> So, my question is :
>>>
>>> 1. Do I need to make any change in xbean.xml to sue any of the
>>> SOAPInterceptor ?
>>> 2. Which interceptor should I use ?
>>> 3. When I did try some, it gave me an error saying JBIMessage cannot be
>>> converted to SOAP etc
>>> 4. How do I actually 'Retrieve' XML data from the SOAP env? I mean the
>>> code.
>>>
>>> Your elaborate answer will help me a lot!
>>>
>>> Thanks,
>>> Milan
>>>
>>>
>>> Freeman Fang wrote:
>>>   
>>>> Hi,
>>>> The message inside servicemix container is JBI style message, which 
>>>> means the message with JBI wrapper.
>>>> If you want to capture the soap xml request, you need add similar 
>>>> interceptors for cxf bc endpoint.
>>>>
>>>> Freeman
>>>>
>>>> doshi_milan wrote:
>>>>     
>>>>> Thanks for the reply. But I do have an issue. Actually I am supposed
>>>>> to
>>>>> capture the SOAP XML request and it seems that the request that I
>>>>> capture
>>>>> is
>>>>> NOT really a SOAP request.
>>>>>
>>>>> Hence , it seems that there is a major change in the Interceptors that
>>>>> I
>>>>> am
>>>>> using. I guess I should be using SOAP interceptors... Can I know which
>>>>> interceptor should I be using and more importantly how do I get SOAP
>>>>> REQUEST
>>>>> / RESPONSE XML message instead of a jbi message ?
>>>>>
>>>>> Is this how I should be defining my XBean ? 
>>>>>
>>>>>  <cxfse:endpoint  useJBIWrapper="false"  >
>>>>>         <cxfse:pojo>
>>>>>           <bean
>>>>> class="com.powercatalyst.ods.osl.pricedata.OdsPriceDataImpl"
>>>>> />
>>>>>         </cxfse:pojo>
>>>>>        : :
>>>>>
>>>>> I need to be able to retrieve the request XML from the SOAP
>>>>> Interceptor.
>>>>> I
>>>>> would appreciate if that is also stated to me.
>>>>>
>>>>> Thanks and regards,
>>>>> Milan
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>       
>>>
>>>   
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Retrieving-SOAP-Header-and-SOAP-Body-using-Interceptors-tp20466758p20546553.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.


Re: Retrieving SOAP Header and SOAP Body using Interceptors

Posted by doshi_milan <md...@powercatalyst.com>.
I guess I may have mixed up too many things in the same posting chain above.
Let me try to put it this way.The flow is very much what you have put forth
.
Client <=> cxf bc  <=> cxf se .

I just want to capture the request / response XML for :
All requests that have failed (for any reasons (application or system
exceptions)). The idea is to divert the failed  requests to another
application.

Thus with this in mind, all I want to achieve is capture the ORIGINAL SOAP
request (and also the response XML as it will have the error details).

Summing up whatever I have already done :
   1. I have a user defined Interceptor that extends from
org.apache.cxf.interceptor.LoggingOutInterceptor.
   2. I override the handleMessage(org.apache.cxf.message.Message message)
method.
   3. I invoke this interceptor ONLY in case of error's fault. (I.e I
achieve this by the following entry within my xbean.xml)
                <cxfse:inFaultInterceptors> 
			<bean class="com.powercatalyst.ods.osl.interceptor.OdsFaultInterceptor"/>
		</cxfse:inFaultInterceptors>
   

What I have achieved :
I am able to capture the request that is jbi based.

What I realloy want to capture is a SOAP request.
 
 1. Do I need to make any change in xbean.xml to sue any of the
     SOAPInterceptor ?
 2. Which interceptor should I use ?
 3. When I did try some, it gave me an error saying JBIMessage cannot be
     converted to SOAP etc

I hope this gives more insight to my issue. Thanks for your time and help!

Regards,
Milan



Freeman Fang wrote:
> 
> Hi Milan,
> 
> I'm not sure I follow your question.
> Would you please describe more details about your scenario?
> Some thing like your work flow, e.g.
> 
> external client <=(1)==> cxf bc <==(2)==> cxf se,
> and at which point you want to dump your soap message? The incoming 
> message or /outgoing message?
> Since the answer could be different depends on what's your real question
> is.
> Freeman
> 
> doshi_milan wrote:
>> Well, first of all thanks for the reply.... Not sure if I interpret your
>> answer.
>>
>> I mean, even I know that a SOAP Interceptor is required.
>>
>> So, my question is :
>>
>> 1. Do I need to make any change in xbean.xml to sue any of the
>> SOAPInterceptor ?
>> 2. Which interceptor should I use ?
>> 3. When I did try some, it gave me an error saying JBIMessage cannot be
>> converted to SOAP etc
>> 4. How do I actually 'Retrieve' XML data from the SOAP env? I mean the
>> code.
>>
>> Your elaborate answer will help me a lot!
>>
>> Thanks,
>> Milan
>>
>>
>> Freeman Fang wrote:
>>   
>>> Hi,
>>> The message inside servicemix container is JBI style message, which 
>>> means the message with JBI wrapper.
>>> If you want to capture the soap xml request, you need add similar 
>>> interceptors for cxf bc endpoint.
>>>
>>> Freeman
>>>
>>> doshi_milan wrote:
>>>     
>>>> Thanks for the reply. But I do have an issue. Actually I am supposed to
>>>> capture the SOAP XML request and it seems that the request that I
>>>> capture
>>>> is
>>>> NOT really a SOAP request.
>>>>
>>>> Hence , it seems that there is a major change in the Interceptors that
>>>> I
>>>> am
>>>> using. I guess I should be using SOAP interceptors... Can I know which
>>>> interceptor should I be using and more importantly how do I get SOAP
>>>> REQUEST
>>>> / RESPONSE XML message instead of a jbi message ?
>>>>
>>>> Is this how I should be defining my XBean ? 
>>>>
>>>>  <cxfse:endpoint  useJBIWrapper="false"  >
>>>>         <cxfse:pojo>
>>>>           <bean
>>>> class="com.powercatalyst.ods.osl.pricedata.OdsPriceDataImpl"
>>>> />
>>>>         </cxfse:pojo>
>>>>        : :
>>>>
>>>> I need to be able to retrieve the request XML from the SOAP
>>>> Interceptor.
>>>> I
>>>> would appreciate if that is also stated to me.
>>>>
>>>> Thanks and regards,
>>>> Milan
>>>>
>>>>
>>>>
>>>>
>>>>       
>>
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Retrieving-SOAP-Header-and-SOAP-Body-using-Interceptors-tp20466758p20544465.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.


Re: Retrieving SOAP Header and SOAP Body using Interceptors

Posted by Freeman Fang <fr...@gmail.com>.
Hi Milan,

I'm not sure I follow your question.
Would you please describe more details about your scenario?
Some thing like your work flow, e.g.

external client <=(1)==> cxf bc <==(2)==> cxf se,
and at which point you want to dump your soap message? The incoming 
message or /outgoing message?
Since the answer could be different depends on what's your real question is.
Freeman

doshi_milan wrote:
> Well, first of all thanks for the reply.... Not sure if I interpret your
> answer.
>
> I mean, even I know that a SOAP Interceptor is required.
>
> So, my question is :
>
> 1. Do I need to make any change in xbean.xml to sue any of the
> SOAPInterceptor ?
> 2. Which interceptor should I use ?
> 3. When I did try some, it gave me an error saying JBIMessage cannot be
> converted to SOAP etc
> 4. How do I actually 'Retrieve' XML data from the SOAP env? I mean the code.
>
> Your elaborate answer will help me a lot!
>
> Thanks,
> Milan
>
>
> Freeman Fang wrote:
>   
>> Hi,
>> The message inside servicemix container is JBI style message, which 
>> means the message with JBI wrapper.
>> If you want to capture the soap xml request, you need add similar 
>> interceptors for cxf bc endpoint.
>>
>> Freeman
>>
>> doshi_milan wrote:
>>     
>>> Thanks for the reply. But I do have an issue. Actually I am supposed to
>>> capture the SOAP XML request and it seems that the request that I capture
>>> is
>>> NOT really a SOAP request.
>>>
>>> Hence , it seems that there is a major change in the Interceptors that I
>>> am
>>> using. I guess I should be using SOAP interceptors... Can I know which
>>> interceptor should I be using and more importantly how do I get SOAP
>>> REQUEST
>>> / RESPONSE XML message instead of a jbi message ?
>>>
>>> Is this how I should be defining my XBean ? 
>>>
>>>  <cxfse:endpoint  useJBIWrapper="false"  >
>>>         <cxfse:pojo>
>>>           <bean
>>> class="com.powercatalyst.ods.osl.pricedata.OdsPriceDataImpl"
>>> />
>>>         </cxfse:pojo>
>>>        : :
>>>
>>> I need to be able to retrieve the request XML from the SOAP Interceptor.
>>> I
>>> would appreciate if that is also stated to me.
>>>
>>> Thanks and regards,
>>> Milan
>>>
>>>
>>>
>>>
>>>       
>
>   


Re: Retrieving SOAP Header and SOAP Body using Interceptors

Posted by doshi_milan <md...@powercatalyst.com>.
Well, first of all thanks for the reply.... Not sure if I interpret your
answer.

I mean, even I know that a SOAP Interceptor is required.

So, my question is :

1. Do I need to make any change in xbean.xml to sue any of the
SOAPInterceptor ?
2. Which interceptor should I use ?
3. When I did try some, it gave me an error saying JBIMessage cannot be
converted to SOAP etc
4. How do I actually 'Retrieve' XML data from the SOAP env? I mean the code.

Your elaborate answer will help me a lot!

Thanks,
Milan


Freeman Fang wrote:
> 
> Hi,
> The message inside servicemix container is JBI style message, which 
> means the message with JBI wrapper.
> If you want to capture the soap xml request, you need add similar 
> interceptors for cxf bc endpoint.
> 
> Freeman
> 
> doshi_milan wrote:
>> Thanks for the reply. But I do have an issue. Actually I am supposed to
>> capture the SOAP XML request and it seems that the request that I capture
>> is
>> NOT really a SOAP request.
>>
>> Hence , it seems that there is a major change in the Interceptors that I
>> am
>> using. I guess I should be using SOAP interceptors... Can I know which
>> interceptor should I be using and more importantly how do I get SOAP
>> REQUEST
>> / RESPONSE XML message instead of a jbi message ?
>>
>> Is this how I should be defining my XBean ? 
>>
>>  <cxfse:endpoint  useJBIWrapper="false"  >
>>         <cxfse:pojo>
>>           <bean
>> class="com.powercatalyst.ods.osl.pricedata.OdsPriceDataImpl"
>> />
>>         </cxfse:pojo>
>>        : :
>>
>> I need to be able to retrieve the request XML from the SOAP Interceptor.
>> I
>> would appreciate if that is also stated to me.
>>
>> Thanks and regards,
>> Milan
>>
>>
>>
>>
> 

-- 
View this message in context: http://www.nabble.com/Retrieving-SOAP-Header-and-SOAP-Body-using-Interceptors-tp20466758p20508645.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.


Re: Retrieving SOAP Header and SOAP Body using Interceptors

Posted by Freeman Fang <fr...@gmail.com>.
Hi,
The message inside servicemix container is JBI style message, which 
means the message with JBI wrapper.
If you want to capture the soap xml request, you need add similar 
interceptors for cxf bc endpoint.

Freeman

doshi_milan wrote:
> Thanks for the reply. But I do have an issue. Actually I am supposed to
> capture the SOAP XML request and it seems that the request that I capture is
> NOT really a SOAP request.
>
> Hence , it seems that there is a major change in the Interceptors that I am
> using. I guess I should be using SOAP interceptors... Can I know which
> interceptor should I be using and more importantly how do I get SOAP REQUEST
> / RESPONSE XML message instead of a jbi message ?
>
> Is this how I should be defining my XBean ? 
>
>  <cxfse:endpoint  useJBIWrapper="false"  >
>         <cxfse:pojo>
>           <bean class="com.powercatalyst.ods.osl.pricedata.OdsPriceDataImpl"
> />
>         </cxfse:pojo>
>        : :
>
> I need to be able to retrieve the request XML from the SOAP Interceptor. I
> would appreciate if that is also stated to me.
>
> Thanks and regards,
> Milan
>
>
>
>
>
>
>
> Freeman Fang wrote:
>   
>> comment inline
>>
>> doshi_milan wrote:
>>     
>>> Thanks for the reply.Actually  I was able to retreieve atleast the
>>> Request
>>> XML.
>>>
>>> I, now, have a class  DHCLOutInterceptor extends
>>> org.apache.cxf.interceptor.LoggingOutInterceptor  .I override the 
>>> handleMessage(org.apache.cxf.message.Message message)  method as follows
>>> :
>>>
>>>  public void handleMessage(org.apache.cxf.message.Message message)  {
>>>     	
>>>     	        MessageExchange exchange =
>>> message.get(javax.jbi.messaging.MessageExchange.class);		
>>> 		NormalizedMessage nm = exchange.getMessage("out");
>>>     	        Source content = nm.getContent();
>>> 		try {
>>> 			String body = (new SourceTransformer()).toString(content);
>>> 			System.out.println("ODSLogOutInterceptor:handleMessage:
>>> body:\n"+body);
>>> 		} catch (TransformerException e) {
>>> 			::
>>>                 }
>>>
>>>     	Strangely, although I have configured it as an OUTBOUND intrerafce I
>>> AM
>>> NOT ABLE TO access the response XML. The NormalizedMessage object
>>> continues
>>> to be null. <br/> If I make it 'in' instead of 'out' I am able to get the
>>> entire request XML (which is very good).However what do I do to get the
>>> outbound response XML? Can someone please explain me what am I missing ?
>>>
>>>   
>>>       
>> If you want to see the outbound message of cxf se endpoint, you should 
>> write an interceptor with phase like PRE_STREAM, the 
>> LoggingOutInterceptor should be exactly same as your scenario, take a 
>> look at class.
>>     
>>> The bean.xml looks like this :
>>>
>>>   <cxfse:endpoint >
>>>         <cxfse:pojo>
>>>                 <bean class="com.company.ods.osl.mydata.OdsPriceDataImpl"
>>> />
>>>         </cxfse:pojo>    
>>> 		
>>> 	<cxfse:inFaultInterceptors> 
>>> 		<bean class="com.company.ods.osl.mydata.ODSFaultInterceptor"/>
>>> 	</cxfse:inFaultInterceptors>
>>> 	<cxfse:outFaultInterceptors>
>>> 		<bean class="com.company.ods.osl.mydata.ODSFaultInterceptor"/>
>>> 	</cxfse:outFaultInterceptors>
>>>   
>>>       
>> You need configure outInterceptors here, not outFaultInterceptors
>>     
>>> Thanks for any feedback!
>>>
>>> Milan
>>>
>>> Freeman Fang wrote:
>>>   
>>>       
>>>> doshi_milan wrote:
>>>>     
>>>>         
>>>>> I am using CXF within Servicemix. 
>>>>>
>>>>> I want to know how would I be able to intercept XML request / response
>>>>> within my code ? I have  created a user defined interceptor which
>>>>> extends
>>>>> from  org.apache.cxf.interceptor.LoggingInInterceptor and similarly
>>>>> another
>>>>> use defined Intercepor which extends from
>>>>> org.apache.cxf.interceptor.LoggingOutInterceptor. I have this in the
>>>>> xbean.xml file as follows :
>>>>>
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>> I can't see your xbean.xml content here, :-)
>>>>     
>>>>         
>>>>>         
>>>>>           
>>>>>         
>>>>>         
>>>>> 			
>>>>> 		
>>>>> 		
>>>>> 			
>>>>> 		
>>>>> 		
>>>>> 		
>>>>> I am able to override the handleMessage method. I know that
>>>>> LoggingInInterceptor can directly log the XML but what I want is to
>>>>> retrieve
>>>>> certain values etc within the interceptor. Thus for now, I want to see
>>>>> how
>>>>> can I retrieve the ENTIRE message within the interceptor. This should
>>>>> be
>>>>> very easy as the logging method probably does it but it is not
>>>>> available
>>>>> to
>>>>> us. I failed to get any sample or documentation. I do not even know if 
>>>>> LoggingInInterceptor /LoggingOutInterceptor are thr right interceptors
>>>>> to
>>>>> be
>>>>> used.
>>>>>   
>>>>>       
>>>>>           
>>>> The LoggingInInterceptor should be what you want, you mean you can't 
>>>> find the source code of LoggingIn/OutInterceptor? They are in cxf code 
>>>> base, and you can find those from
>>>> http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/
>>>>     
>>>>         
>>>>> Any help will be much appreciated.
>>>>>
>>>>> Thanks!
>>>>> Milan Doshi
>>>>>   
>>>>>       
>>>>>           
>>>>     
>>>>         
>>>   
>>>       
>>
>>     
>
>   


Re: Retrieving SOAP Header and SOAP Body using Interceptors

Posted by doshi_milan <md...@powercatalyst.com>.
Thanks for the reply. But I do have an issue. Actually I am supposed to
capture the SOAP XML request and it seems that the request that I capture is
NOT really a SOAP request.

Hence , it seems that there is a major change in the Interceptors that I am
using. I guess I should be using SOAP interceptors... Can I know which
interceptor should I be using and more importantly how do I get SOAP REQUEST
/ RESPONSE XML message instead of a jbi message ?

Is this how I should be defining my XBean ? 

 <cxfse:endpoint  useJBIWrapper="false"  >
        <cxfse:pojo>
          <bean class="com.powercatalyst.ods.osl.pricedata.OdsPriceDataImpl"
/>
        </cxfse:pojo>
       : :

I need to be able to retrieve the request XML from the SOAP Interceptor. I
would appreciate if that is also stated to me.

Thanks and regards,
Milan







Freeman Fang wrote:
> 
> comment inline
> 
> doshi_milan wrote:
>> Thanks for the reply.Actually  I was able to retreieve atleast the
>> Request
>> XML.
>>
>> I, now, have a class  DHCLOutInterceptor extends
>> org.apache.cxf.interceptor.LoggingOutInterceptor  .I override the 
>> handleMessage(org.apache.cxf.message.Message message)  method as follows
>> :
>>
>>  public void handleMessage(org.apache.cxf.message.Message message)  {
>>     	
>>     	        MessageExchange exchange =
>> message.get(javax.jbi.messaging.MessageExchange.class);		
>> 		NormalizedMessage nm = exchange.getMessage("out");
>>     	        Source content = nm.getContent();
>> 		try {
>> 			String body = (new SourceTransformer()).toString(content);
>> 			System.out.println("ODSLogOutInterceptor:handleMessage:
>> body:\n"+body);
>> 		} catch (TransformerException e) {
>> 			::
>>                 }
>>
>>     	Strangely, although I have configured it as an OUTBOUND intrerafce I
>> AM
>> NOT ABLE TO access the response XML. The NormalizedMessage object
>> continues
>> to be null. <br/> If I make it 'in' instead of 'out' I am able to get the
>> entire request XML (which is very good).However what do I do to get the
>> outbound response XML? Can someone please explain me what am I missing ?
>>
>>   
> If you want to see the outbound message of cxf se endpoint, you should 
> write an interceptor with phase like PRE_STREAM, the 
> LoggingOutInterceptor should be exactly same as your scenario, take a 
> look at class.
>> The bean.xml looks like this :
>>
>>   <cxfse:endpoint >
>>         <cxfse:pojo>
>>                 <bean class="com.company.ods.osl.mydata.OdsPriceDataImpl"
>> />
>>         </cxfse:pojo>    
>> 		
>> 	<cxfse:inFaultInterceptors> 
>> 		<bean class="com.company.ods.osl.mydata.ODSFaultInterceptor"/>
>> 	</cxfse:inFaultInterceptors>
>> 	<cxfse:outFaultInterceptors>
>> 		<bean class="com.company.ods.osl.mydata.ODSFaultInterceptor"/>
>> 	</cxfse:outFaultInterceptors>
>>   
> You need configure outInterceptors here, not outFaultInterceptors
>> Thanks for any feedback!
>>
>> Milan
>>
>> Freeman Fang wrote:
>>   
>>> doshi_milan wrote:
>>>     
>>>> I am using CXF within Servicemix. 
>>>>
>>>> I want to know how would I be able to intercept XML request / response
>>>> within my code ? I have  created a user defined interceptor which
>>>> extends
>>>> from  org.apache.cxf.interceptor.LoggingInInterceptor and similarly
>>>> another
>>>> use defined Intercepor which extends from
>>>> org.apache.cxf.interceptor.LoggingOutInterceptor. I have this in the
>>>> xbean.xml file as follows :
>>>>
>>>>
>>>>   
>>>>       
>>> I can't see your xbean.xml content here, :-)
>>>     
>>>>         
>>>>           
>>>>         
>>>>         
>>>> 			
>>>> 		
>>>> 		
>>>> 			
>>>> 		
>>>> 		
>>>> 		
>>>> I am able to override the handleMessage method. I know that
>>>> LoggingInInterceptor can directly log the XML but what I want is to
>>>> retrieve
>>>> certain values etc within the interceptor. Thus for now, I want to see
>>>> how
>>>> can I retrieve the ENTIRE message within the interceptor. This should
>>>> be
>>>> very easy as the logging method probably does it but it is not
>>>> available
>>>> to
>>>> us. I failed to get any sample or documentation. I do not even know if 
>>>> LoggingInInterceptor /LoggingOutInterceptor are thr right interceptors
>>>> to
>>>> be
>>>> used.
>>>>   
>>>>       
>>> The LoggingInInterceptor should be what you want, you mean you can't 
>>> find the source code of LoggingIn/OutInterceptor? They are in cxf code 
>>> base, and you can find those from
>>> http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/
>>>     
>>>> Any help will be much appreciated.
>>>>
>>>> Thanks!
>>>> Milan Doshi
>>>>   
>>>>       
>>>
>>>     
>>
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Retrieving-SOAP-Header-and-SOAP-Body-using-Interceptors-tp20466758p20491593.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.


Re: Retrieving SOAP Header and SOAP Body using Interceptors

Posted by Freeman Fang <fr...@gmail.com>.
comment inline

doshi_milan wrote:
> Thanks for the reply.Actually  I was able to retreieve atleast the Request
> XML.
>
> I, now, have a class  DHCLOutInterceptor extends
> org.apache.cxf.interceptor.LoggingOutInterceptor  .I override the 
> handleMessage(org.apache.cxf.message.Message message)  method as follows :
>
>  public void handleMessage(org.apache.cxf.message.Message message)  {
>     	
>     	        MessageExchange exchange =
> message.get(javax.jbi.messaging.MessageExchange.class);		
> 		NormalizedMessage nm = exchange.getMessage("out");
>     	        Source content = nm.getContent();
> 		try {
> 			String body = (new SourceTransformer()).toString(content);
> 			System.out.println("ODSLogOutInterceptor:handleMessage: body:\n"+body);
> 		} catch (TransformerException e) {
> 			::
>                 }
>
>     	Strangely, although I have configured it as an OUTBOUND intrerafce I AM
> NOT ABLE TO access the response XML. The NormalizedMessage object continues
> to be null. <br/> If I make it 'in' instead of 'out' I am able to get the
> entire request XML (which is very good).However what do I do to get the
> outbound response XML? Can someone please explain me what am I missing ?
>
>   
If you want to see the outbound message of cxf se endpoint, you should 
write an interceptor with phase like PRE_STREAM, the 
LoggingOutInterceptor should be exactly same as your scenario, take a 
look at class.
> The bean.xml looks like this :
>
>   <cxfse:endpoint >
>         <cxfse:pojo>
>                 <bean class="com.company.ods.osl.mydata.OdsPriceDataImpl" />
>         </cxfse:pojo>    
> 		
> 	<cxfse:inFaultInterceptors> 
> 		<bean class="com.company.ods.osl.mydata.ODSFaultInterceptor"/>
> 	</cxfse:inFaultInterceptors>
> 	<cxfse:outFaultInterceptors>
> 		<bean class="com.company.ods.osl.mydata.ODSFaultInterceptor"/>
> 	</cxfse:outFaultInterceptors>
>   
You need configure outInterceptors here, not outFaultInterceptors
> Thanks for any feedback!
>
> Milan
>
> Freeman Fang wrote:
>   
>> doshi_milan wrote:
>>     
>>> I am using CXF within Servicemix. 
>>>
>>> I want to know how would I be able to intercept XML request / response
>>> within my code ? I have  created a user defined interceptor which extends
>>> from  org.apache.cxf.interceptor.LoggingInInterceptor and similarly
>>> another
>>> use defined Intercepor which extends from
>>> org.apache.cxf.interceptor.LoggingOutInterceptor. I have this in the
>>> xbean.xml file as follows :
>>>
>>>
>>>   
>>>       
>> I can't see your xbean.xml content here, :-)
>>     
>>>         
>>>           
>>>         
>>>         
>>> 			
>>> 		
>>> 		
>>> 			
>>> 		
>>> 		
>>> 		
>>> I am able to override the handleMessage method. I know that
>>> LoggingInInterceptor can directly log the XML but what I want is to
>>> retrieve
>>> certain values etc within the interceptor. Thus for now, I want to see
>>> how
>>> can I retrieve the ENTIRE message within the interceptor. This should be
>>> very easy as the logging method probably does it but it is not available
>>> to
>>> us. I failed to get any sample or documentation. I do not even know if 
>>> LoggingInInterceptor /LoggingOutInterceptor are thr right interceptors to
>>> be
>>> used.
>>>   
>>>       
>> The LoggingInInterceptor should be what you want, you mean you can't 
>> find the source code of LoggingIn/OutInterceptor? They are in cxf code 
>> base, and you can find those from
>> http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/
>>     
>>> Any help will be much appreciated.
>>>
>>> Thanks!
>>> Milan Doshi
>>>   
>>>       
>>
>>     
>
>   


Re: Retrieving SOAP Header and SOAP Body using Interceptors

Posted by doshi_milan <md...@powercatalyst.com>.
Thanks for the reply.Actually  I was able to retreieve atleast the Request
XML.

I, now, have a class  DHCLOutInterceptor extends
org.apache.cxf.interceptor.LoggingOutInterceptor  .I override the 
handleMessage(org.apache.cxf.message.Message message)  method as follows :

 public void handleMessage(org.apache.cxf.message.Message message)  {
    	
    	        MessageExchange exchange =
message.get(javax.jbi.messaging.MessageExchange.class);		
		NormalizedMessage nm = exchange.getMessage("out");
    	        Source content = nm.getContent();
		try {
			String body = (new SourceTransformer()).toString(content);
			System.out.println("ODSLogOutInterceptor:handleMessage: body:\n"+body);
		} catch (TransformerException e) {
			::
                }

    	Strangely, although I have configured it as an OUTBOUND intrerafce I AM
NOT ABLE TO access the response XML. The NormalizedMessage object continues
to be null. <br/> If I make it 'in' instead of 'out' I am able to get the
entire request XML (which is very good).However what do I do to get the
outbound response XML? Can someone please explain me what am I missing ?

The bean.xml looks like this :

  <cxfse:endpoint >
        <cxfse:pojo>
                <bean class="com.company.ods.osl.mydata.OdsPriceDataImpl" />
        </cxfse:pojo>    
		
	<cxfse:inFaultInterceptors> 
		<bean class="com.company.ods.osl.mydata.ODSFaultInterceptor"/>
	</cxfse:inFaultInterceptors>
	<cxfse:outFaultInterceptors>
		<bean class="com.company.ods.osl.mydata.ODSFaultInterceptor"/>
	</cxfse:outFaultInterceptors>

Thanks for any feedback!

Milan

Freeman Fang wrote:
> 
> doshi_milan wrote:
>> I am using CXF within Servicemix. 
>>
>> I want to know how would I be able to intercept XML request / response
>> within my code ? I have  created a user defined interceptor which extends
>> from  org.apache.cxf.interceptor.LoggingInInterceptor and similarly
>> another
>> use defined Intercepor which extends from
>> org.apache.cxf.interceptor.LoggingOutInterceptor. I have this in the
>> xbean.xml file as follows :
>>
>>
>>   
> I can't see your xbean.xml content here, :-)
>>         
>>           
>>         
>>         
>> 			
>> 		
>> 		
>> 			
>> 		
>> 		
>> 		
>> I am able to override the handleMessage method. I know that
>> LoggingInInterceptor can directly log the XML but what I want is to
>> retrieve
>> certain values etc within the interceptor. Thus for now, I want to see
>> how
>> can I retrieve the ENTIRE message within the interceptor. This should be
>> very easy as the logging method probably does it but it is not available
>> to
>> us. I failed to get any sample or documentation. I do not even know if 
>> LoggingInInterceptor /LoggingOutInterceptor are thr right interceptors to
>> be
>> used.
>>   
> The LoggingInInterceptor should be what you want, you mean you can't 
> find the source code of LoggingIn/OutInterceptor? They are in cxf code 
> base, and you can find those from
> http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/
>> Any help will be much appreciated.
>>
>> Thanks!
>> Milan Doshi
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Retrieving-SOAP-Header-and-SOAP-Body-using-Interceptors-tp20466758p20475400.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.


Re: Retrieving SOAP Header and SOAP Body using Interceptors

Posted by Freeman Fang <fr...@gmail.com>.
doshi_milan wrote:
> I am using CXF within Servicemix. 
>
> I want to know how would I be able to intercept XML request / response
> within my code ? I have  created a user defined interceptor which extends
> from  org.apache.cxf.interceptor.LoggingInInterceptor and similarly another
> use defined Intercepor which extends from
> org.apache.cxf.interceptor.LoggingOutInterceptor. I have this in the
> xbean.xml file as follows :
>
>
>   
I can't see your xbean.xml content here, :-)
>         
>           
>         
>         
> 			
> 		
> 		
> 			
> 		
> 		
> 		
> I am able to override the handleMessage method. I know that
> LoggingInInterceptor can directly log the XML but what I want is to retrieve
> certain values etc within the interceptor. Thus for now, I want to see how
> can I retrieve the ENTIRE message within the interceptor. This should be
> very easy as the logging method probably does it but it is not available to
> us. I failed to get any sample or documentation. I do not even know if 
> LoggingInInterceptor /LoggingOutInterceptor are thr right interceptors to be
> used.
>   
The LoggingInInterceptor should be what you want, you mean you can't 
find the source code of LoggingIn/OutInterceptor? They are in cxf code 
base, and you can find those from
http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/
> Any help will be much appreciated.
>
> Thanks!
> Milan Doshi
>